diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2005-11-26 03:24:38 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2005-11-26 03:24:38 +0100 |
commit | dfde8e08f71cfd24c9c247962bb4ddbed0b089fa (patch) | |
tree | 55430ebfb8eb7b238a3ba9787e92f352fa9175ab | |
parent | 30f248a785685491a7e55c804e9221c04c8bdce4 (diff) |
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.
-rw-r--r-- | protocols/nogaim.c | 16 |
1 files changed, 14 insertions, 2 deletions
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 ) |