2006-01-12 [colin] 1.9.100cvs140

* src/folder.c
	* src/folder.h
	* src/main.c
		Add --subscribe option
		Let sylpheed-claws email@domain.com equivalent to --compose
		Let sylpheed-claws proto://blah.com equivalent to --subscribe
This commit is contained in:
Colin Leroy 2006-01-12 20:01:48 +00:00
parent 06dc8874b5
commit c64d94d2f5
6 changed files with 67 additions and 1 deletions

View file

@ -1,3 +1,12 @@
2006-01-12 [colin] 1.9.100cvs140
* src/folder.c
* src/folder.h
* src/main.c
Add --subscribe option
Let sylpheed-claws email@domain.com equivalent to --compose
Let sylpheed-claws proto://blah.com equivalent to --subscribe
2006-01-12 [paul] 1.9.100cvs139
* src/mainwindow.c

View file

@ -1123,3 +1123,4 @@
( cvs diff -u -r 1.30.2.7 -r 1.30.2.8 tools/README; cvs diff -u -r 1.1.2.1 -r 1.1.2.2 tools/filter_conv_new.pl; ) > 1.9.100cvs137.patchset
( cvs diff -u -r 1.382.2.218 -r 1.382.2.219 src/compose.c; ) > 1.9.100cvs138.patchset
( cvs diff -u -r 1.274.2.85 -r 1.274.2.86 src/mainwindow.c; cvs diff -u -r 1.60.2.27 -r 1.60.2.28 src/prefs_actions.c; cvs diff -u -r 1.1.2.7 -r 1.1.2.8 src/gtk/foldersort.c; ) > 1.9.100cvs139.patchset
( cvs diff -u -r 1.213.2.72 -r 1.213.2.73 src/folder.c; cvs diff -u -r 1.87.2.22 -r 1.87.2.23 src/folder.h; cvs diff -u -r 1.115.2.70 -r 1.115.2.71 src/main.c; ) > 1.9.100cvs140.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=9
MICRO_VERSION=100
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=139
EXTRA_VERSION=140
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -3746,4 +3746,18 @@ gboolean folder_has_parent_of_type(FolderItem *item,
return FALSE;
}
gboolean folder_subscribe (const gchar *uri)
{
GList *cur;
for (cur = folder_get_list(); cur != NULL; cur = g_list_next(cur)) {
Folder *folder = (Folder *) cur->data;
if (folder->klass->subscribe
&& folder->klass->subscribe(folder, uri)) {
return TRUE;
}
}
return FALSE;
}
#undef PUT_ESCAPE_STR

View file

@ -573,6 +573,8 @@ struct _FolderClass
FolderItem *item,
gboolean batch);
void (*synchronise) (FolderItem *item);
gboolean (*subscribe) (Folder *folder,
const gchar *uri);
};
struct _FolderItem
@ -816,4 +818,5 @@ void folder_item_process_open (FolderItem *item,
void (*before_proc_func)(gpointer data),
void (*after_proc_func)(gpointer data),
gpointer data);
gboolean folder_subscribe (const gchar *uri);
#endif /* __FOLDER_H__ */

View file

@ -139,6 +139,8 @@ static struct RemoteCmd {
int online_mode;
gchar *crash_params;
gboolean exit;
gboolean subscribe;
const gchar *subscribe_uri;
} cmd;
static void parse_cmd_opt(int argc, char *argv[]);
@ -544,6 +546,9 @@ int main(int argc, char *argv[])
g_ptr_array_free(cmd.attach_files, TRUE);
cmd.attach_files = NULL;
}
if (cmd.subscribe)
folder_subscribe(cmd.subscribe_uri);
if (cmd.send)
send_queue();
@ -660,6 +665,12 @@ static void parse_cmd_opt(int argc, char *argv[])
cmd.compose_mailto = p;
i++;
}
} else if (!strncmp(argv[i], "--subscribe", 11)) {
const gchar *p = argv[i + 1];
if (p && *p != '\0' && *p != '-') {
cmd.subscribe = TRUE;
cmd.subscribe_uri = p;
}
} else if (!strncmp(argv[i], "--attach", 8)) {
const gchar *p = argv[i + 1];
gchar *file;
@ -716,6 +727,7 @@ static void parse_cmd_opt(int argc, char *argv[])
g_print(_("Usage: %s [OPTION]...\n"), base);
g_print("%s\n", _(" --compose [address] open composition window"));
g_print("%s\n", _(" --subscribe [uri] subscribe to the given URI if possible"));
g_print("%s\n", _(" --attach file1 [file2]...\n"
" open composition window with specified files\n"
" attached"));
@ -744,6 +756,26 @@ static void parse_cmd_opt(int argc, char *argv[])
exit(0);
} else if (!strncmp(argv[i], "--exit", 6)) {
cmd.exit = TRUE;
} else if (i == 1 && argc == 2) {
/* only one parameter. Do something intelligent about it */
if (strstr(argv[i], "@") && !strstr(argv[i], "://")) {
const gchar *p = argv[i];
cmd.compose = TRUE;
cmd.compose_mailto = NULL;
if (p && *p != '\0' && *p != '-') {
if (!strncmp(p, "mailto:", 7))
cmd.compose_mailto = p + 7;
else
cmd.compose_mailto = p;
}
} else if (strstr(argv[i], "://")) {
const gchar *p = argv[i];
if (p && *p != '\0' && *p != '-') {
cmd.subscribe = TRUE;
cmd.subscribe_uri = p;
}
}
}
}
@ -948,6 +980,10 @@ static gint prohibit_duplicate_launch(void)
fd_write_all(uxsock, compose_str, strlen(compose_str));
g_free(compose_str);
} else if (cmd.subscribe) {
gchar *str = g_strdup_printf("subscribe %s\n", cmd.subscribe_uri);
fd_write_all(uxsock, str, strlen(str));
g_free(str);
} else if (cmd.send) {
fd_write_all(uxsock, "send\n", 5);
} else if (cmd.online_mode == ONLINE_MODE_ONLINE) {
@ -1059,6 +1095,9 @@ static void lock_socket_input_cb(gpointer data,
g_free(mailto);
} else if (!strncmp(buf, "compose", 7)) {
open_compose_new(buf + strlen("compose") + 1, NULL);
} else if (!strncmp(buf, "subscribe", 9)) {
main_window_popup(mainwin);
folder_subscribe(buf + strlen("subscribe") + 1);
} else if (!strncmp(buf, "send", 4)) {
send_queue();
} else if (!strncmp(buf, "online", 6)) {