* Cursor disappears in some cases with abook_readline() on Solaris. If
you have problems it is recommended to use ncurses library
* fseek in ldif import filter should be eliminated
+* mutt import filter imports only first e-mail address
0.5.1
- minor filter fixes
+ - tried to fix \" quotation problem with mutt import filter
+ - removed obsolete filesel_sort option from abookrc manual page
- added bbdb2xx translator source to contrib
0.5.0
# Define the identity of the package.
PACKAGE=abook
- VERSION=0.5.0
+ VERSION=0.5.1pre
cat >>confdefs.h <<_ACEOF
dnl abook configure.in
AC_INIT(abook.c)
-AM_INIT_AUTOMAKE(abook, 0.5.0)
+AM_INIT_AUTOMAKE(abook, 0.5.1pre)
AM_CONFIG_HEADER(config.h)
AC_DEFINE(HAVE_SNPRINTF, 0, [Define if snprintf is available.])
return ret;
}
+static int sort_field = -1;
+
static int
namecmp(const void *i1, const void *i2)
{
list_item a, b;
+ assert(sort_field >= 0 && sort_field <= LAST_FIELD);
+
itemcpy(a, i1);
itemcpy(b, i2);
- return safe_strcoll( a[NAME], b[NAME] );
+ return safe_strcoll( a[sort_field], b[sort_field] );
+}
+
+static int
+name2field(char *name)
+{
+ int i, ret = -1;
+
+ for(i = 0; i < ITEM_FIELDS; i++) {
+ if(!strcasecmp(name, abook_fields[i].key)) {
+ ret = i;
+ break;
+ }
+ }
+
+ return ret;
}
void
-sort_database()
+sort_by_field(int field)
{
select_none();
+
+ assert(field <= LAST_FIELD);
+
+ if(field < 0) {
+ field = name2field(opt_get_str(STR_SORT_FIELD));
+ if(field < 0) {
+ statusline_msg("Not valid field value defined "
+ "in configuration");
+ return;
+ }
+ }
+
+ sort_field = field;
qsort((void *)database, items, sizeof(list_item), namecmp);
void free_list_item(list_item item);
void remove_selected_items();
void sort_surname();
-void sort_database();
+void sort_by_field(int field);
char *get_surname(char *s);
int find_item(char *str, int start, int search_fields[]);
int is_selected(int item);
return 0;
}
+static void
+mutt_fix_quoting(char *p)
+{
+ char *escape = 0;
+
+ for(; *p; p++) {
+ switch(*p) {
+ case '\"':
+ if(escape)
+ *escape = ' ';
+ break;
+ case '\\':
+ escape = p;
+ break;
+ default:
+ escape = 0;
+ }
+ }
+}
+
static void
mutt_parse_email(list_item item)
{
char *line = item[NAME];
- char *start = line, *tmp;
+ char *tmp;
char *name, *email;
+#if 0
+ char *start = line;
int i = 0;
+#endif
+ mutt_fix_quoting(line);
tmp = strconcat("From: ", line, NULL);
getname(tmp, &name, &email);
free(tmp);
else
return;
+ /*
+ * this is completely broken
+ */
+#if 0
while( (start = strchr(start, ',')) && i++ < MAX_EMAILS - 1) {
tmp = strconcat("From: ", ++start, NULL);
getname(tmp, &name, &email);
}
}
}
+#endif
}
static int
"\n",
" s sort database\n",
" S \"surname sort\"\n",
+" F sort by field (defined in configuration file)\n",
"\n",
" / find\n",
" \\ find next\n",
{ "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, FALSE },
{ "add_email_prevent_duplicates", OT_BOOL, BOOL_ADD_EMAIL_PREVENT_DUPLICATES, FALSE },
+ { "sort_field", OT_STR, STR_SORT_FIELD, UL "nick" },
{ NULL }
};
STR_PRINT_COMMAND,
STR_WWW_COMMAND,
STR_ADDRESS_STYLE,
+ STR_SORT_FIELD,
STR_MAX
};
set use_ascii_only=false
set add_email_prevent_duplicates=false
+
+set sort_field=nick
case 'o': ui_open_datafile(); break;
- case 's': sort_database(); break;
+ case 's': sort_by_field(NAME); break;
case 'S': sort_surname(); break;
+ case 'F': sort_by_field(-1); break;
case '/': ui_find(0); break;
case '\\': ui_find(1); break;