From 449a51de265cb3b4f0f5003e09fbbb030247c972 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Tue, 16 Mar 2010 10:18:02 +0000 Subject: Include non-away status messages in blist and whois responses. The whois change is a complete violation of the IRC protocol but that doesn't seem to be an uncommon thing. --- irc_commands.c | 2 ++ protocols/nogaim.c | 13 +++++++------ root_commands.c | 9 +++++++-- user.h | 1 + 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/irc_commands.c b/irc_commands.c index 750bbcf5..a417e0d9 100644 --- a/irc_commands.c +++ b/irc_commands.c @@ -496,6 +496,8 @@ static void irc_cmd_whois( irc_t *irc, char **cmd ) irc_reply( irc, 301, "%s :%s", u->nick, "User is offline" ); else if( u->away ) irc_reply( irc, 301, "%s :%s", u->nick, u->away ); + if( u->status_msg ) + irc_reply( irc, 333, "%s :Status: %s", u->nick, u->status_msg ); irc_reply( irc, 318, "%s :End of /WHOIS list", nick ); } diff --git a/protocols/nogaim.c b/protocols/nogaim.c index 9c6daeaf..c326e378 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -646,11 +646,9 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, oa = u->away != NULL; oo = u->online; - if( u->away ) - { - g_free( u->away ); - u->away = NULL; - } + g_free( u->away ); + g_free( u->status_msg ); + u->away = u->status_msg = NULL; if( ( flags & OPT_LOGGED_IN ) && !u->online ) { @@ -688,7 +686,10 @@ void imcb_buddy_status( struct im_connection *ic, const char *handle, int flags, u->away = g_strdup( "Away" ); } } - /* else waste_any_state_information_for_now(); */ + else + { + u->status_msg = g_strdup( message ); + } /* LISPy... */ if( ( set_getbool( &ic->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ diff --git a/root_commands.c b/root_commands.c index b3432b9b..15e6e72a 100644 --- a/root_commands.c +++ b/root_commands.c @@ -913,7 +913,7 @@ static void cmd_blist( irc_t *irc, char **cmd ) else if( cmd[1] && g_strcasecmp( cmd[1], "online" ) == 0 ) online = 1; else - online = away = 1; + online = away = 1; if( strchr( irc->umode, 'b' ) != NULL ) format = "%s\t%s\t%s"; @@ -926,8 +926,13 @@ static void cmd_blist( irc_t *irc, char **cmd ) { if( online == 1 ) { + char st[256] = "Online"; + + if( u->status_msg ) + g_snprintf( st, sizeof( st ) - 1, "Online (%s)", u->status_msg ); + g_snprintf( s, sizeof( s ) - 1, "%s@%s %s(%s)", u->user, u->host, u->ic->acc->prpl->name, u->ic->acc->user ); - irc_usermsg( irc, format, u->nick, s, "Online" ); + irc_usermsg( irc, format, u->nick, s, st ); } n_online ++; diff --git a/user.h b/user.h index 9d8a41a0..8c4f9c44 100644 --- a/user.h +++ b/user.h @@ -33,6 +33,7 @@ typedef struct __USER char *realname; char *away; + char *status_msg; /* Non-IRC extension, but nice on IM. */ char is_private; char online; -- cgit v1.2.3