From dfde8e08f71cfd24c9c247962bb4ddbed0b089fa Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 26 Nov 2005 03:24:38 +0100 Subject: Messages specific to a connection only mention the handle now if necessary (i.e. if there is more than one connection to that IM-network). Should close #26. --- protocols/nogaim.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'protocols/nogaim.c') diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 2a696992..101cbb14 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -233,8 +233,9 @@ void hide_login_progress_error( struct gaim_connection *gc, char *msg ) void serv_got_crap( struct gaim_connection *gc, char *format, ... ) { va_list params; - char text[1024], buf[1024]; + char text[1024], buf[1024], acc_id[33]; char *msg; + account_t *a; va_start( params, format ); g_vsnprintf( text, sizeof( text ), format, params ); @@ -250,7 +251,18 @@ void serv_got_crap( struct gaim_connection *gc, char *format, ... ) ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) ) strip_html( msg ); - irc_usermsg( gc->irc, "%s(%s) - %s", proto_name[gc->protocol], gc->username, msg ); + /* Try to find a different connection on the same protocol. */ + for( a = gc->irc->accounts; a; a = a->next ) + if( proto_prpl[a->protocol] == gc->prpl && a->gc != gc ) + break; + + /* If we found one, add the screenname to the acc_id. */ + if( a ) + g_snprintf( acc_id, 32, "%s(%s)", proto_name[gc->protocol], gc->username ); + else + g_snprintf( acc_id, 32, "%s", proto_name[gc->protocol] ); + + irc_usermsg( gc->irc, "%s - %s", acc_id, msg ); } static gboolean send_keepalive( gpointer d ) -- cgit v1.2.3