diff options
author | dequis <dx@dxzone.com.ar> | 2016-11-04 20:48:52 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2016-11-04 20:48:52 -0300 |
commit | fecdd715ed3975415a78a342880dbde0e734a759 (patch) | |
tree | 74fbff33db6534cfa1523bd3f1ad5178bb506fac | |
parent | 50988d1f5048cc1ca1f8b3af77eb3ad6f909c1c0 (diff) |
purple: hack to pass server parameter to jabber's input request
Because our purple module is all about hacks, adding more can't hurt.
There's a string comparison for "Enter a Conference Server". It's
gettexted in the source but in practice it isn't affected by locale
(bitlbee disables localization).
Worst case, if this stops working, it will open an input request like it
did before this commit. It also does that in purple's jabber if you
don't provide a server parameter.
-rw-r--r-- | protocols/purple/bpurple.h | 1 | ||||
-rw-r--r-- | protocols/purple/purple.c | 24 |
2 files changed, 23 insertions, 2 deletions
diff --git a/protocols/purple/bpurple.h b/protocols/purple/bpurple.h index 39677b86..8225f0b8 100644 --- a/protocols/purple/bpurple.h +++ b/protocols/purple/bpurple.h @@ -12,6 +12,7 @@ struct purple_data GHashTable *input_requests; guint next_request_id; + char *chat_list_server; }; #endif /* !BPURPLE_H */ diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index c40efa0b..d476afba 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -388,6 +388,7 @@ static void purple_logout(struct im_connection *ic) purple_connections = g_slist_remove(purple_connections, ic); purple_accounts_remove(pd->account); imcb_chat_list_free(ic); + g_free(pd->chat_list_server); g_hash_table_destroy(pd->input_requests); g_free(pd); } @@ -782,6 +783,9 @@ void purple_chat_list(struct im_connection *ic, const char *server) return; } + g_free(pd->chat_list_server); + pd->chat_list_server = (server && *server) ? g_strdup(server) : NULL; + list = purple_roomlist_get_list(pd->account->gc); if (list) { @@ -1229,8 +1233,19 @@ void* prplcb_request_input(const char *title, const char *primary, { struct im_connection *ic = purple_ic_by_pa(account); struct purple_data *pd = ic->proto_data; - struct request_input_data *ri = g_new0(struct request_input_data, 1); - guint id = pd->next_request_id++; + struct request_input_data *ri; + guint id; + + /* hack so that jabber's chat list doesn't ask for conference server twice */ + if (pd->chat_list_server && title && g_strcmp0(title, "Enter a Conference Server") == 0) { + ((ri_callback_t) ok_cb)(user_data, pd->chat_list_server); + g_free(pd->chat_list_server); + pd->chat_list_server = NULL; + return NULL; + } + + id = pd->next_request_id++; + ri = g_new0(struct request_input_data, 1); ri->id = id; ri->ic = ic; @@ -1391,6 +1406,7 @@ static void prplcb_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *r static void prplcb_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress) { struct im_connection *ic; + struct purple_data *pd; struct purple_roomlist_data *rld = list->ui_data; if (in_progress || !rld) { @@ -1400,6 +1416,10 @@ static void prplcb_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progre ic = purple_ic_by_pa(list->account); imcb_chat_list_free(ic); + pd = ic->proto_data; + g_free(pd->chat_list_server); + pd->chat_list_server = NULL; + ic->chatlist = g_slist_reverse(rld->chats); rld->chats = NULL; |