diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-09 01:40:38 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-04-09 01:40:38 +0100 |
commit | cca06921729ecd1ab4beaecfef001a218e5d0010 (patch) | |
tree | 77902d63f4a73535ea942b149e2428a345f8ca32 /protocols/nogaim.c | |
parent | 7a90d02eede836f60a119cf516b145c8bf601d3c (diff) |
Added imcb_chat_nick_hint() and use it in the Twitter module to get saner
channel names.
This also closes bug #577, making the Skype module a bit nicer.
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r-- | protocols/nogaim.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 36d97f51..fca8b302 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -821,6 +821,35 @@ struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ) return c; } +void imcb_chat_name_hint( struct groupchat *c, const char *name ) +{ + if( !c->joined ) + { + struct im_connection *ic = c->ic; + char stripped[MAX_NICK_LENGTH+1], *full_name; + + strncpy( stripped, name, MAX_NICK_LENGTH ); + stripped[MAX_NICK_LENGTH] = '\0'; + nick_strip( stripped ); + if( set_getbool( &ic->irc->set, "lcnicks" ) ) + nick_lc( stripped ); + + full_name = g_strdup_printf( "&%s", stripped ); + + if( stripped[0] && + nick_cmp( stripped, ic->irc->channel + 1 ) != 0 && + irc_chat_by_channel( ic->irc, full_name ) == NULL ) + { + g_free( c->channel ); + c->channel = full_name; + } + else + { + g_free( full_name ); + } + } +} + void imcb_chat_free( struct groupchat *c ) { struct im_connection *ic = c->ic; |