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 | |
| 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.
| -rw-r--r-- | protocols/nogaim.c | 29 | ||||
| -rw-r--r-- | protocols/nogaim.h | 1 | ||||
| -rw-r--r-- | protocols/twitter/twitter_lib.c | 3 | 
3 files changed, 33 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; diff --git a/protocols/nogaim.h b/protocols/nogaim.h index 3c5e539f..48a80413 100644 --- a/protocols/nogaim.h +++ b/protocols/nogaim.h @@ -301,6 +301,7 @@ G_MODULE_EXPORT void imcb_chat_invited( struct im_connection *ic, char *handle,   *   the user her/himself. At that point the group chat will be visible to the   *   user, too. */  G_MODULE_EXPORT struct groupchat *imcb_chat_new( struct im_connection *ic, const char *handle ); +G_MODULE_EXPORT void imcb_chat_name_hint( struct groupchat *c, const char *name );  G_MODULE_EXPORT void imcb_chat_add_buddy( struct groupchat *b, const char *handle );  /* To remove a handle from a group chat. Reason can be NULL. */  G_MODULE_EXPORT void imcb_chat_remove_buddy( struct groupchat *b, const char *handle, const char *reason ); diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 9ca4ead6..93f71f3b 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -406,7 +406,10 @@ static void twitter_groupchat(struct im_connection *ic, GSList *list)  	// Create a new groupchat if it does not exsist.  	if (!td->home_timeline_gc)  	{    +		char *name_hint = g_strdup_printf( "Twitter_%s", ic->acc->user );  		td->home_timeline_gc = gc = imcb_chat_new( ic, "home/timeline" ); +		imcb_chat_name_hint( gc, name_hint ); +		g_free( name_hint );  		// Add the current user to the chat...  		imcb_chat_add_buddy( gc, ic->acc->user );  	} | 
