aboutsummaryrefslogtreecommitdiffstats
path: root/protocols
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2009-11-23 23:23:37 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2009-11-23 23:23:37 +0000
commitcd741d8e2bb0b7d08cf36d90f5332a639f190281 (patch)
tree07e7b369dc080bbc6f59a5e2ac13180704fa1e27 /protocols
parent4e041946706d3fc3aed405152028b02ec2794902 (diff)
Fixed compatibility with non-libpurple version: oscar is now recognized
as a protocol name, and removed prpl- hack from nogaim.c.
Diffstat (limited to 'protocols')
-rw-r--r--protocols/nogaim.c8
-rw-r--r--protocols/nogaim.h1
-rw-r--r--protocols/purple/purple.c43
3 files changed, 29 insertions, 23 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index c0d4a953..f80653ff 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -110,14 +110,6 @@ struct prpl *find_protocol(const char *name)
if( g_strcasecmp( proto->name, name ) == 0 )
return proto;
-
-#ifdef WITH_PURPLE
- /* I know, hardcoding is evil, but that doesn't make it
- impossible. :-) */
- if( g_strncasecmp( proto->name, "prpl-", 5 ) == 0 &&
- g_strcasecmp( proto->name + 5, name ) == 0 )
- return proto;
-#endif
}
return NULL;
diff --git a/protocols/nogaim.h b/protocols/nogaim.h
index dc6154e2..ae329b91 100644
--- a/protocols/nogaim.h
+++ b/protocols/nogaim.h
@@ -132,6 +132,7 @@ struct prpl {
/* You should set this to the name of your protocol.
* - The user sees this name ie. when imcb_log() is used. */
const char *name;
+ void *data;
/* Added this one to be able to add per-account settings, don't think
* it should be used for anything else. You are supposed to use the
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c
index 6f1e6ae9..a8733f5d 100644
--- a/protocols/purple/purple.c
+++ b/protocols/purple/purple.c
@@ -148,7 +148,7 @@ static void purple_login( account_t *acc )
on dead connections. */
purple_connections = g_slist_prepend( purple_connections, ic );
- ic->proto_data = pa = purple_account_new( acc->user, acc->prpl->name );
+ ic->proto_data = pa = purple_account_new( acc->user, (char*) acc->prpl->data );
purple_account_set_password( pa, acc->pass );
purple_sync_settings( acc, pa );
@@ -450,6 +450,7 @@ static void purple_ui_init()
void purple_initmodule()
{
+ struct prpl funcs;
GList *prots;
if( B_EV_IO_READ != PURPLE_INPUT_READ ||
@@ -477,24 +478,36 @@ void purple_initmodule()
/* Meh? */
purple_prefs_load();
+ memset( &funcs, 0, sizeof( funcs ) );
+ funcs.login = purple_login;
+ funcs.init = purple_init;
+ funcs.logout = purple_logout;
+ funcs.buddy_msg = purple_buddy_msg;
+ funcs.away_states = purple_away_states;
+ funcs.set_away = purple_set_away;
+ funcs.add_buddy = purple_add_buddy;
+ funcs.remove_buddy = purple_remove_buddy;
+ funcs.keepalive = purple_keepalive;
+ funcs.send_typing = purple_send_typing;
+ funcs.handle_cmp = g_strcasecmp;
+
for( prots = purple_plugins_get_protocols(); prots; prots = prots->next )
{
- struct prpl *ret = g_new0( struct prpl, 1 );
PurplePlugin *prot = prots->data;
+ struct prpl *ret;
- ret->name = prot->info->id;
- ret->login = purple_login;
- ret->init = purple_init;
- ret->logout = purple_logout;
- ret->buddy_msg = purple_buddy_msg;
- ret->away_states = purple_away_states;
- ret->set_away = purple_set_away;
- ret->add_buddy = purple_add_buddy;
- ret->remove_buddy = purple_remove_buddy;
- ret->keepalive = purple_keepalive;
- ret->send_typing = purple_send_typing;
- ret->handle_cmp = g_strcasecmp;
-
+ ret = g_memdup( &funcs, sizeof( funcs ) );
+ ret->name = ret->data = prot->info->id;
+ if( strncmp( ret->name, "prpl-", 5 ) == 0 )
+ ret->name += 5;
register_protocol( ret );
+
+ if( g_strcasecmp( prot->info->id, "prpl-aim" ) == 0 )
+ {
+ ret = g_memdup( &funcs, sizeof( funcs ) );
+ ret->name = "oscar";
+ ret->data = prot->info->id;
+ register_protocol( ret );
+ }
}
}