diff options
Diffstat (limited to 'protocols/purple/purple.c')
-rw-r--r-- | protocols/purple/purple.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 71b495db..c40efa0b 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); @@ -346,7 +358,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; @@ -1708,7 +1720,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); } } |