diff options
-rw-r--r-- | .bzrignore | 1 | ||||
-rw-r--r-- | protocols/jabber/jabber.c | 1 | ||||
-rw-r--r-- | protocols/msn/msn.c | 1 | ||||
-rw-r--r-- | protocols/nogaim.c | 40 | ||||
-rw-r--r-- | protocols/nogaim.h | 3 | ||||
-rw-r--r-- | protocols/oscar/auth.c | 8 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 7 | ||||
-rw-r--r-- | protocols/oscar/oscar_util.c | 6 | ||||
-rw-r--r-- | protocols/oscar/tlv.c | 42 | ||||
-rw-r--r-- | protocols/yahoo/yahoo.c | 1 | ||||
-rw-r--r-- | user.c | 2 |
11 files changed, 19 insertions, 93 deletions
@@ -11,3 +11,4 @@ bitlbee.plg *.aps *.clw debian +tags diff --git a/protocols/jabber/jabber.c b/protocols/jabber/jabber.c index 5d499950..25b51ba4 100644 --- a/protocols/jabber/jabber.c +++ b/protocols/jabber/jabber.c @@ -2435,6 +2435,7 @@ void jabber_init() ret->buddy_free = jabber_buddy_free; ret->alias_buddy = jabber_roster_update; ret->group_buddy = jabber_group_change; + ret->cmp_buddynames = g_strcasecmp; register_protocol (ret); } diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 42d763e8..b828d31c 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -396,6 +396,7 @@ void msn_init() ret->add_deny = msn_add_deny; ret->rem_deny = msn_rem_deny; ret->send_typing = msn_send_typing; + ret->cmp_buddynames = g_strcasecmp; register_protocol(ret); } diff --git a/protocols/nogaim.c b/protocols/nogaim.c index a5f034c7..bf1f52fc 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -224,44 +224,6 @@ static char *proto_away_alias_find( GList *gcm, char *away ) return( NULL ); } -/* Compare two handles for a specific protocol. For most protocols, - g_strcasecmp is okay, but for AIM, for example, it's not. This really - should be a compare function inside the PRPL module, but I do it this - way for now because I don't want to touch the Gaim code too much since - it's not going to be here for too long anymore. */ -int handle_cmp( char *a, char *b, struct prpl *protocol ) -{ - if( !strcmp(protocol->name, "oscar") ) - { - /* AIM, being teh evil, thinks it's cool that users can put - random spaces in screennames. But "A B" and "AB" are - equal. Hrmm, okay. */ - while( 1 ) - { - while( *a == ' ' ) a ++; - while( *b == ' ' ) b ++; - - if( *a && *b ) - { - if( tolower( *a ) != tolower( *b ) ) - return( 1 ); - } - else if( *a || *b ) - return( 1 ); - else - return( 0 ); - - a ++; - b ++; - } - } - else - { - return( g_strcasecmp( a, b ) ); - } -} - - /* multi.c */ struct gaim_connection *new_gaim_conn( struct aim_user *user ) @@ -896,7 +858,7 @@ void add_chat_buddy( struct conversation *b, char *handle ) irc_usermsg( b->gc->irc, "User %s added to conversation %d", handle, b->id ); /* It might be yourself! */ - if( handle_cmp ( handle, b->gc->user->username, b->gc->prpl ) == 0 ) + if( b->gc->prpl->cmp_buddynames( handle, b->gc->user->username ) == 0 ) { u = user_find( b->gc->irc, b->gc->irc->nick ); if( !b->joined ) diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 477f1df9..3d5006d9 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -241,6 +241,8 @@ struct prpl { void (* buddy_free) (struct buddy *); char *(* get_status_string) (struct gaim_connection *gc, int stat); + + int (* cmp_buddynames) (const char *who1, const char *who2); }; #define UC_UNAVAILABLE 1 @@ -265,7 +267,6 @@ char *set_eval_charset( irc_t *irc, set_t *set, char *value ); void nogaim_init(); int proto_away( struct gaim_connection *gc, char *away ); char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ); -int handle_cmp( char *a, char *b, struct prpl *protocol ); gboolean auto_reconnect( gpointer data ); void cancel_auto_reconnect( struct account *a ); diff --git a/protocols/oscar/auth.c b/protocols/oscar/auth.c index c25a4604..eb6a9d64 100644 --- a/protocols/oscar/auth.c +++ b/protocols/oscar/auth.c @@ -351,17 +351,11 @@ int aim_encode_password_md5(const char *password, const char *key, guint8 *diges static int aim_encode_password(const char *password, guint8 *encoded) { guint8 encoding_table[] = { -#if 0 /* old v1 table */ - 0xf3, 0xb3, 0x6c, 0x99, - 0x95, 0x3f, 0xac, 0xb6, - 0xc5, 0xfa, 0x6b, 0x63, - 0x69, 0x6c, 0xc3, 0x9f -#else /* v2.1 table, also works for ICQ */ + /* v2.1 table, also works for ICQ */ 0xf3, 0x26, 0x81, 0xc4, 0x39, 0x86, 0xdb, 0x92, 0x71, 0xa3, 0xb9, 0xe6, 0x53, 0x7a, 0x95, 0x7c -#endif }; int i; diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 6ff0a742..7711733f 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -1207,11 +1207,7 @@ static int incomingim_chan4(aim_session_t *sess, aim_conn_t *conn, aim_userinfo_ return 1; } -/* -int handle_cmp_aim(const char * a, const char * b) { - return handle_cmp(a, b, PROTO_TOC); -} -*/ + static int gaim_parse_incoming_im(aim_session_t *sess, aim_frame_t *fr, ...) { int channel, ret = 0; aim_userinfo_t *userinfo; @@ -2483,6 +2479,7 @@ void oscar_init() ret->rem_deny = oscar_rem_deny; ret->set_permit_deny = oscar_set_permit_deny; ret->keepalive = oscar_keepalive; + ret->cmp_buddynames = aim_sncmp; ret->get_status_string = oscar_get_status_string; register_protocol(ret); diff --git a/protocols/oscar/oscar_util.c b/protocols/oscar/oscar_util.c index ed8409a4..1bb27559 100644 --- a/protocols/oscar/oscar_util.c +++ b/protocols/oscar/oscar_util.c @@ -1,9 +1,3 @@ -/* - * - * - * - */ - #include <aim.h> #include <ctype.h> diff --git a/protocols/oscar/tlv.c b/protocols/oscar/tlv.c index 74d177ad..11b89758 100644 --- a/protocols/oscar/tlv.c +++ b/protocols/oscar/tlv.c @@ -1,21 +1,13 @@ #include <aim.h> -static aim_tlv_t *createtlv(void) -{ - return g_new0(aim_tlv_t, 1); -} - static void freetlv(aim_tlv_t **oldtlv) { - if (!oldtlv || !*oldtlv) return; g_free((*oldtlv)->value); g_free(*oldtlv); *oldtlv = NULL; - - return; } /** @@ -45,33 +37,15 @@ aim_tlvlist_t *aim_readtlvchain(aim_bstream_t *bs) type = aimbs_get16(bs); length = aimbs_get16(bs); -#if 0 /* temporarily disabled until I know if they're still doing it or not */ - /* - * Okay, so now AOL has decided that any TLV of - * type 0x0013 can only be two bytes, despite - * what the actual given length is. So here - * we dump any invalid TLVs of that sort. Hopefully - * theres no special cases to this special case. - * - mid (30jun2000) - */ - if ((type == 0x0013) && (length != 0x0002)) - length = 0x0002; -#else - if (0) - ; -#endif - else { + cur = g_new0(aim_tlvlist_t, 1); - cur = g_new0(aim_tlvlist_t, 1); + cur->tlv = g_new0(aim_tlv_t, 1); + cur->tlv->type = type; + if ((cur->tlv->length = length)) + cur->tlv->value = aimbs_getraw(bs, length); - cur->tlv = createtlv(); - cur->tlv->type = type; - if ((cur->tlv->length = length)) - cur->tlv->value = aimbs_getraw(bs, length); - - cur->next = list; - list = cur; - } + cur->next = list; + list = cur; } return list; @@ -172,7 +146,7 @@ int aim_addtlvtochain_raw(aim_tlvlist_t **list, const guint16 t, const guint16 l if (!(newtlv = g_new0(aim_tlvlist_t, 1))) return 0; - if (!(newtlv->tlv = createtlv())) { + if (!(newtlv->tlv = g_new0(aim_tlv_t, 1))) { g_free(newtlv); return 0; } diff --git a/protocols/yahoo/yahoo.c b/protocols/yahoo/yahoo.c index cc3ffdf7..a3ebd28c 100644 --- a/protocols/yahoo/yahoo.c +++ b/protocols/yahoo/yahoo.c @@ -410,6 +410,7 @@ void byahoo_init( ) ret->chat_invite = byahoo_chat_invite; ret->chat_leave = byahoo_chat_leave; ret->chat_open = byahoo_chat_open; + ret->cmp_buddynames = g_strcasecmp; register_protocol(ret); } @@ -145,7 +145,7 @@ user_t *user_findhandle( struct gaim_connection *gc, char *handle ) while( u ) { - if( u->gc == gc && u->handle && handle_cmp( u->handle, handle, gc->prpl) == 0 ) + if( u->gc == gc && u->handle && gc->prpl->cmp_buddynames ( u->handle, handle ) == 0 ) break; u = u->next; } |