diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-10 01:30:39 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-07-10 01:30:39 +0100 | 
| commit | 534e4069e0cfa8aee82f82603dc3ca05562a85dd (patch) | |
| tree | 3b9bd37d2094d325e94e4ed62a1ec86415d4ea40 /protocols/twitter/twitter.c | |
| parent | f3b6764f269490f11a8adbddeeb06964331917d0 (diff) | |
Translate "nick:" to "@nick" in Twitter rooms to make tab completion easier.
Not working yet with stripped/mangled nicknames.
Diffstat (limited to 'protocols/twitter/twitter.c')
| -rw-r--r-- | protocols/twitter/twitter.c | 24 | 
1 files changed, 22 insertions, 2 deletions
| diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 2e3ab634..f3fe8922 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -315,8 +315,28 @@ static void twitter_remove_buddy( struct im_connection *ic, char *who, char *gro  static void twitter_chat_msg( struct groupchat *c, char *message, int flags )  { -	if( c && message && twitter_length_check(c->ic, message)) -		twitter_post_status(c->ic, message); +	if( c && message && twitter_length_check( c->ic, message ) ) +	{ +		char *s, *new = NULL; +		 +		if( ( s = strchr( message, ':' ) ) || +		    ( s = strchr( message, ',' ) ) ) +		{ +			bee_user_t *bu; +			 +			new = g_strdup( message ); +			new[s-message] = '\0'; +			if( ( bu = bee_user_by_handle( c->ic->bee, c->ic, new ) ) ) +			{ +				sprintf( new, "@%s", bu->handle ); +				new[s-message+1] = ' '; +				message = new; +			} +		} +		 +		twitter_post_status( c->ic, message ); +		g_free( new ); +	}  }  static void twitter_chat_invite( struct groupchat *c, char *who, char *message ) | 
