aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2006-03-21 09:12:22 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2006-03-21 09:12:22 +0100
commitaefa533eb48587d9f509a8dcab358061b72c7b3b (patch)
tree269b4625750f1ae7b366085e8487906fd2096d8a
parent1ad104ab06fe3f7db1b55cc178e92e43cbda9d95 (diff)
Added a special +b usermode for easier parseability of some things.
(For now blist and qlist, but more should come)
-rw-r--r--irc.h2
-rw-r--r--protocols/oscar/oscar.c2
-rw-r--r--query.c12
-rw-r--r--root_commands.c41
4 files changed, 42 insertions, 15 deletions
diff --git a/irc.h b/irc.h
index 5c53273a..86721058 100644
--- a/irc.h
+++ b/irc.h
@@ -32,7 +32,7 @@
#define IRC_LOGIN_TIMEOUT 60
#define IRC_PING_STRING "PinglBee"
-#define UMODES "iasw"
+#define UMODES "abisw"
#define UMODES_PRIV "Ro"
#define CMODES "nt"
#define CMODE "t"
diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c
index 7f5c0fc3..97384afb 100644
--- a/protocols/oscar/oscar.c
+++ b/protocols/oscar/oscar.c
@@ -1149,7 +1149,7 @@ static void gaim_icq_authask(struct gaim_connection *gc, guint32 uin, char *msg)
if (strlen(msg) > 6)
reason = msg + 6;
- dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason:\n\n%s", uin, reason ? reason : "No reason given.");
+ dialog_msg = g_strdup_printf("The user %u wants to add you to their buddy list for the following reason: %s", uin, reason ? reason : "No reason given.");
data->gc = gc;
data->uin = uin;
do_ask_dialog(gc, dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
diff --git a/query.c b/query.c
index 670dde36..eb2f45df 100644
--- a/query.c
+++ b/query.c
@@ -39,6 +39,17 @@ query_t *query_add( irc_t *irc, struct gaim_connection *gc, char *question, void
q->no = no;
q->data = data;
+ if( strchr( irc->umode, 'b' ) != NULL )
+ {
+ char *s;
+
+ /* At least for the machine-parseable version, get rid of
+ newlines to make "parsing" easier. */
+ for( s = q->question; *s; s ++ )
+ if( *s == '\r' || *s == '\n' )
+ *s = ' ';
+ }
+
if( irc->queries )
{
query_t *l = irc->queries;
@@ -126,7 +137,6 @@ void query_answer( irc_t *irc, query_t *q, int ans )
q = query_default( irc );
disp = 1;
}
- //Using irc_usermsg instead of serv_got_crap because \x02A is a char too, so a SPACE is needed.
if( ans )
{
q->yes( NULL, q->data );
diff --git a/root_commands.c b/root_commands.c
index f69442d3..34445b9e 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -634,7 +634,8 @@ static void cmd_blist( irc_t *irc, char **cmd )
{
int online = 0, away = 0, offline = 0;
user_t *u;
- char s[64];
+ char s[256];
+ char *format;
int n_online = 0, n_away = 0, n_offline = 0;
if( cmd[1] && g_strcasecmp( cmd[1], "all" ) == 0 )
@@ -648,30 +649,46 @@ static void cmd_blist( irc_t *irc, char **cmd )
else
online = away = 1;
- irc_usermsg( irc, "%-16.16s %-40.40s %s", "Nick", "User/Host/Network", "Status" );
+ if( strchr( irc->umode, 'b' ) != NULL )
+ format = "%s\t%s\t%s";
+ else
+ format = "%-16.16s %-40.40s %s";
+
+ irc_usermsg( irc, format, "Nick", "User/Host/Network", "Status" );
- if( online == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
+ for( u = irc->users; u; u = u->next ) if( u->gc && u->online && !u->away )
{
- g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
- irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Online" );
+ if( online == 1 )
+ {
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
+ irc_usermsg( irc, format, u->nick, s, "Online" );
+ }
+
n_online ++;
}
- if( away == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
+ for( u = irc->users; u; u = u->next ) if( u->gc && u->online && u->away )
{
- g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
- irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, u->away );
+ if( away == 1 )
+ {
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
+ irc_usermsg( irc, format, u->nick, s, u->away );
+ }
n_away ++;
}
- if( offline == 1 ) for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
+ for( u = irc->users; u; u = u->next ) if( u->gc && !u->online )
{
- g_snprintf( s, 63, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
- irc_usermsg( irc, "%-16.16s %-40.40s %s", u->nick, s, "Offline" );
+ if( offline == 1 )
+ {
+ g_snprintf( s, sizeof( s ) - 1, "%s@%s (%s)", u->user, u->host, u->gc->user->prpl->name );
+ irc_usermsg( irc, format, u->nick, s, "Offline" );
+ }
n_offline ++;
}
- irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
+ if( strchr( irc->umode, 'b' ) == NULL )
+ irc_usermsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
}
static void cmd_nick( irc_t *irc, char **cmd )