diff options
author | Marius Halden <marius.h@lden.org> | 2016-11-12 10:50:46 +0100 |
---|---|---|
committer | Marius Halden <marius.h@lden.org> | 2016-11-12 10:50:46 +0100 |
commit | d54c742b856702377d713b490d07e23facac6288 (patch) | |
tree | 7db5bede175590c1f54242b3015aa9c78df730fa /protocols | |
parent | 5f35d535f22aaf747956aafafd301442a07626a4 (diff) | |
parent | fca468311f1fd9880ed2ae4991b2ecc261fd34d5 (diff) |
Merge branch 'master' into patched-master
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/purple/bpurple.h | 1 | ||||
-rw-r--r-- | protocols/purple/purple.c | 45 |
2 files changed, 40 insertions, 6 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 db523ada..ce3c1f97 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -100,9 +100,21 @@ static gboolean purple_menu_cmp(const char *a, const char *b) return (*a == '\0' && *b == '\0'); } +static char *purple_get_account_prpl_id(account_t *acc) +{ + /* "oscar" is how non-purple bitlbee calls it, + * and it might be icq or aim, depending on the username */ + if (g_strcmp0(acc->prpl->name, "oscar") == 0) { + return (g_ascii_isdigit(acc->user[0])) ? "prpl-icq" : "prpl-aim"; + } + + return acc->prpl->data; +} + static void purple_init(account_t *acc) { - PurplePlugin *prpl = purple_plugins_find_with_id((char *) acc->prpl->data); + char *prpl_id = purple_get_account_prpl_id(acc); + PurplePlugin *prpl = purple_plugins_find_with_id(prpl_id); PurplePluginProtocolInfo *pi = prpl->info->extra_info; PurpleAccount *pa; GList *i, *st; @@ -268,7 +280,7 @@ static void purple_init(account_t *acc) /* Go through all away states to figure out if away/status messages are possible. */ - pa = purple_account_new(acc->user, (char *) acc->prpl->data); + pa = purple_account_new(acc->user, prpl_id); for (st = purple_account_get_status_types(pa); st; st = st->next) { PurpleStatusPrimitive prim = purple_status_type_get_primitive(st->data); @@ -358,7 +370,7 @@ static void purple_login(account_t *acc) purple_connections = g_slist_prepend(purple_connections, ic); ic->proto_data = pd = g_new0(struct purple_data, 1); - pd->account = purple_account_new(acc->user, (char *) acc->prpl->data); + pd->account = purple_account_new(acc->user, purple_get_account_prpl_id(acc)); pd->input_requests = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); pd->next_request_id = 0; @@ -390,6 +402,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); } @@ -784,6 +797,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) { @@ -1231,8 +1247,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; @@ -1393,6 +1420,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) { @@ -1402,6 +1430,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; @@ -1722,7 +1754,8 @@ void purple_initmodule() /*if (g_strcasecmp(prot->info->id, "prpl-aim") == 0) { ret = g_memdup(&funcs, sizeof(funcs)); ret->name = "oscar"; - ret->data = prot->info->id; + /* purple_get_account_prpl_id() determines the actual protocol ID (icq/aim) */ + ret->data = NULL; register_protocol(ret); }*/ } |