aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipc.c6
-rw-r--r--irc.c8
-rw-r--r--irc.h5
-rw-r--r--irc_commands.c4
-rw-r--r--irc_im.c23
-rw-r--r--irc_send.c59
-rw-r--r--nick.c8
-rw-r--r--otr.c290
-rw-r--r--protocols/nogaim.c4
-rw-r--r--protocols/purple/purple.c2
-rw-r--r--query.c6
-rw-r--r--root_commands.c256
-rw-r--r--storage_xml.c10
13 files changed, 368 insertions, 313 deletions
diff --git a/ipc.c b/ipc.c
index 5da9d8e4..26102d46 100644
--- a/ipc.c
+++ b/ipc.c
@@ -355,7 +355,7 @@ static void ipc_child_cmd_takeover( irc_t *irc, char **cmd )
{
irc_switch_fd( irc, ipc_child_recv_fd );
irc_sync( irc );
- irc_usermsg( irc, "You've successfully taken over your old session" );
+ irc_rootmsg( irc, "You've successfully taken over your old session" );
ipc_child_recv_fd = -1;
ipc_to_master_str( "TAKEOVER DONE\r\n" );
@@ -373,7 +373,7 @@ static void ipc_child_cmd_takeover( irc_t *irc, char **cmd )
else if( strcmp( cmd[1], "FAIL" ) == 0 )
{
/* Master->New connection */
- irc_usermsg( irc, "Could not take over old session" );
+ irc_rootmsg( irc, "Could not take over old session" );
}
}
@@ -411,7 +411,7 @@ static void ipc_child_cmd_takeover_yes( void *data )
/* Drop credentials, we'll shut down soon and shouldn't overwrite
any settings. */
- irc_usermsg( irc, "Trying to take over existing session" );
+ irc_rootmsg( irc, "Trying to take over existing session" );
irc_desync( irc );
diff --git a/irc.c b/irc.c
index c9d1cc39..ffcc6cb3 100644
--- a/irc.c
+++ b/irc.c
@@ -362,7 +362,7 @@ void irc_process( irc_t *irc )
so let's be a little bit paranoid here: */
if( irc->status & USTATUS_LOGGED_IN )
{
- irc_usermsg( irc, "Error: Charset mismatch detected. The charset "
+ irc_rootmsg( irc, "Error: Charset mismatch detected. The charset "
"setting is currently set to %s, so please make "
"sure your IRC client will send and accept text in "
"that charset, or tell BitlBee which charset to "
@@ -766,7 +766,7 @@ int irc_check_login( irc_t *irc )
irc->root->last_channel = irc->default_channel;
- irc_usermsg( irc,
+ irc_rootmsg( irc,
"Welcome to the BitlBee gateway!\n\n"
"If you've never used BitlBee before, please do read the help "
"information using the \x02help\x02 command. Lots of FAQs are "
@@ -909,7 +909,7 @@ static char *set_eval_charset( set_t *set, char *value )
{
g_free( test );
g_iconv_close( oc );
- irc_usermsg( irc, "Unsupported character set: The IRC protocol "
+ irc_rootmsg( irc, "Unsupported character set: The IRC protocol "
"only supports 8-bit character sets." );
return NULL;
}
@@ -940,7 +940,7 @@ static char *set_eval_bw_compat( set_t *set, char *value )
char *val;
GSList *l;
- irc_usermsg( irc, "Setting `%s' is obsolete, use the `show_users' "
+ irc_rootmsg( irc, "Setting `%s' is obsolete, use the `show_users' "
"channel setting instead.", set->key );
if( strcmp( set->key, "away_devoice" ) == 0 && !bool2int( value ) )
diff --git a/irc.h b/irc.h
index fec63967..f186b96a 100644
--- a/irc.h
+++ b/irc.h
@@ -316,7 +316,10 @@ void irc_exec( irc_t *irc, char **cmd );
void irc_send_num( irc_t *irc, int code, char *format, ... ) G_GNUC_PRINTF( 3, 4 );
void irc_send_login( irc_t *irc );
void irc_send_motd( irc_t *irc );
-void irc_usermsg( irc_t *irc, char *format, ... );
+const char *irc_user_msgdest( irc_user_t *iu );
+void irc_rootmsg( irc_t *irc, char *format, ... );
+void irc_usermsg( irc_user_t *iu, char *format, ... );
+void irc_usernotice( irc_user_t *iu, char *format, ... );
void irc_send_join( irc_channel_t *ic, irc_user_t *iu );
void irc_send_part( irc_channel_t *ic, irc_user_t *iu, const char *reason );
void irc_send_quit( irc_user_t *iu, const char *reason );
diff --git a/irc_commands.c b/irc_commands.c
index a1933fa6..144f6589 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -91,7 +91,7 @@ static void irc_cmd_nick( irc_t *irc, char **cmd )
irc_setpass( irc, NULL );
irc->status &= ~USTATUS_IDENTIFIED;
irc_umode_set( irc, "-R", 1 );
- irc_usermsg( irc, "Changing nicks resets your identify status. "
+ irc_rootmsg( irc, "Changing nicks resets your identify status. "
"Re-identify or register a new account if you want "
"your configuration to be saved. See \x02help "
"nick_changes\x02." );
@@ -432,7 +432,7 @@ static void irc_cmd_oper_hack( irc_t *irc, char **cmd )
if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
{
set_setstr( &a->set, "password", password );
- irc_usermsg( irc, "Password added to IM account "
+ irc_rootmsg( irc, "Password added to IM account "
"%s(%s)", a->prpl->name, a->user );
/* The IRC client may expect this. 491 suggests the OPER
password was wrong, so the client won't expect a +o.
diff --git a/irc_im.c b/irc_im.c
index 6add08dd..e54842fd 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -196,34 +196,25 @@ static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_,
{
irc_t *irc = bee->ui_data;
irc_user_t *iu = (irc_user_t *) bu->ui_data;
- char *dst, *prefix = NULL;
+ const char *dst;
+ char *prefix = NULL;
char *wrapped, *ts = NULL;
- irc_channel_t *ic = NULL;
char *msg = g_strdup( msg_ );
GSList *l;
if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )
ts = irc_format_timestamp( irc, sent_at );
- /* Too similar to irc_usermsg()... */
- if( iu->last_channel )
+ dst = irc_user_msgdest( iu );
+ if( dst != irc->user->nick )
{
- if( iu->last_channel->flags & IRC_CHANNEL_JOINED )
- ic = iu->last_channel;
- else
- ic = irc_channel_with_user( irc, iu );
- }
-
- if( ic )
- {
- dst = ic->name;
+ /* if not messaging directly, call user by name */
prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" );
}
else
{
- dst = irc->user->nick;
prefix = ts;
- ts = NULL;
+ ts = NULL; /* don't double-free */
}
for( l = irc_plugins; l; l = l->next )
@@ -992,7 +983,7 @@ static char *set_eval_room_account( set_t *set, char *value )
return SET_INVALID;
else if( !acc->prpl->chat_join )
{
- irc_usermsg( ic->irc, "Named chatrooms not supported on that account." );
+ irc_rootmsg( ic->irc, "Named chatrooms not supported on that account." );
return SET_INVALID;
}
diff --git a/irc_send.c b/irc_send.c
index 681fc95f..7739f798 100644
--- a/irc_send.c
+++ b/irc_send.c
@@ -109,33 +109,62 @@ void irc_send_motd( irc_t *irc )
close( fd );
}
-void irc_usermsg( irc_t *irc, char *format, ... )
+/* Used by some funcs that generate PRIVMSGs to figure out if we're talking to
+ this person in /query or in a control channel. WARNING: callers rely on
+ this returning a pointer at irc->user_nick, not a copy of it. */
+const char *irc_user_msgdest( irc_user_t *iu )
{
+ irc_t *irc = iu->irc;
irc_channel_t *ic = NULL;
- irc_user_t *iu = irc->root;
- char text[2048];
- va_list params;
- char *dst;
-
- va_start( params, format );
- g_vsnprintf( text, sizeof( text ), format, params );
- va_end( params );
-
- /* Too similar to bee_irc_user_msg()... */
+
if( iu->last_channel )
{
if( iu->last_channel->flags & IRC_CHANNEL_JOINED )
ic = iu->last_channel;
else
- ic = irc_channel_with_user( irc, irc->root );
+ ic = irc_channel_with_user( irc, iu );
}
if( ic )
- dst = ic->name;
+ return ic->name;
else
- dst = irc->user->nick;
+ return irc->user->nick;
+}
+
+/* cmd = "PRIVMSG" or "NOTICE" */
+static void irc_usermsg_( const char *cmd, irc_user_t *iu, const char *format, va_list params )
+{
+ char text[2048];
+ const char *dst;
- irc_send_msg( irc->root, "PRIVMSG", dst, text, NULL );
+ g_vsnprintf( text, sizeof( text ), format, params );
+
+ dst = irc_user_msgdest( iu );
+ irc_send_msg( iu, cmd, dst, text, NULL );
+}
+
+void irc_usermsg(irc_user_t *iu, char *format, ... )
+{
+ va_list params;
+ va_start( params, format );
+ irc_usermsg_( "PRIVMSG", iu, format, params );
+ va_end( params );
+}
+
+void irc_usernotice(irc_user_t *iu, char *format, ... )
+{
+ va_list params;
+ va_start( params, format );
+ irc_usermsg_( "NOTICE", iu, format, params );
+ va_end( params );
+}
+
+void irc_rootmsg( irc_t *irc, char *format, ... )
+{
+ va_list params;
+ va_start( params, format );
+ irc_usermsg_( "PRIVMSG", irc->root, format, params );
+ va_end( params );
}
void irc_send_join( irc_channel_t *ic, irc_user_t *iu )
diff --git a/nick.c b/nick.c
index 92d4c258..0d394ecb 100644
--- a/nick.c
+++ b/nick.c
@@ -242,17 +242,17 @@ void nick_dedupe( bee_user_t *bu, char nick[MAX_NICK_LENGTH+1] )
{
int i;
- irc_usermsg( irc, "Warning: Almost had an infinite loop in nick_get()! "
+ irc_rootmsg( irc, "Warning: Almost had an infinite loop in nick_get()! "
"This used to be a fatal BitlBee bug, but we tried to fix it. "
"This message should *never* appear anymore. "
"If it does, please *do* send us a bug report! "
"Please send all the following lines in your report:" );
- irc_usermsg( irc, "Trying to get a sane nick for handle %s", bu->handle );
+ irc_rootmsg( irc, "Trying to get a sane nick for handle %s", bu->handle );
for( i = 0; i < MAX_NICK_LENGTH; i ++ )
- irc_usermsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] );
+ irc_rootmsg( irc, "Char %d: %c/%d", i, nick[i], nick[i] );
- irc_usermsg( irc, "FAILED. Returning an insane nick now. Things might break. "
+ irc_rootmsg( irc, "FAILED. Returning an insane nick now. Things might break. "
"Good luck, and please don't forget to paste the lines up here "
"in #bitlbee on OFTC or in a mail to wilmer@gaast.net" );
diff --git a/otr.c b/otr.c
index 3968da96..5b36a228 100644
--- a/otr.c
+++ b/otr.c
@@ -277,12 +277,12 @@ void otr_load(irc_t *irc)
g_snprintf(s, 511, "%s%s.otr_keys", global.conf->configdir, irc->user->nick);
e = otrl_privkey_read(irc->otr->us, s);
if(e && e!=enoent) {
- irc_usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
+ irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
}
g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick);
e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL);
if(e && e!=enoent) {
- irc_usermsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
+ irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
}
/* check for otr keys on all accounts */
@@ -290,7 +290,7 @@ void otr_load(irc_t *irc)
kg = otr_check_for_key(a) || kg;
}
if(kg) {
- irc_usermsg(irc, "Notice: "
+ irc_rootmsg(irc, "Notice: "
"The accounts above do not have OTR encryption keys associated with them, yet. "
"These keys are now being generated in the background. "
"You will be notified as they are completed. "
@@ -308,7 +308,7 @@ void otr_save(irc_t *irc)
g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick);
e = otrl_privkey_write_fingerprints(irc->otr->us, s);
if(e) {
- irc_usermsg(irc, "otr save: %s: %s", s, gcry_strerror(e));
+ irc_rootmsg(irc, "otr save: %s: %s", s, gcry_strerror(e));
}
chmod(s, 0600);
}
@@ -347,13 +347,13 @@ int otr_check_for_key(account_t *a)
k = otrl_privkey_find(irc->otr->us, a->user, a->prpl->name);
if(k) {
- irc_usermsg(irc, "otr: %s/%s ready", a->user, a->prpl->name);
+ irc_rootmsg(irc, "otr: %s/%s ready", a->user, a->prpl->name);
return 0;
} if(keygen_in_progress(irc, a->user, a->prpl->name)) {
- irc_usermsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name);
+ irc_rootmsg(irc, "otr: keygen for %s/%s already in progress", a->user, a->prpl->name);
return 0;
} else {
- irc_usermsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name);
+ irc_rootmsg(irc, "otr: starting background keygen for %s/%s", a->user, a->prpl->name);
otr_keygen(irc, a->user, a->prpl->name);
return 1;
}
@@ -364,7 +364,6 @@ char *otr_filter_msg_in(irc_user_t *iu, char *msg, int flags)
int ignore_msg;
char *newmsg = NULL;
OtrlTLV *tlvs = NULL;
- char *colormsg;
irc_t *irc = iu->irc;
struct im_connection *ic = iu->bu->ic;
@@ -384,45 +383,59 @@ char *otr_filter_msg_in(irc_user_t *iu, char *msg, int flags)
return NULL;
} else if(!newmsg) {
/* this was a non-OTR message */
- return g_strdup(msg);
+ return msg;
} else {
/* OTR has processed this message */
ConnContext *context = otrl_context_find(irc->otr->us, iu->bu->handle,
ic->acc->user, ic->acc->prpl->name, 0, NULL, NULL, NULL);
+ /* we're done with the original msg, which will be caller-freed. */
+ /* NB: must not change the newmsg pointer, since we free it. */
+ msg = newmsg;
+
if(context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
/* HTML decoding */
/* perform any necessary stripping that the top level would miss */
if(set_getbool(&ic->bee->set, "otr_does_html") &&
!(ic->flags & OPT_DOES_HTML) &&
set_getbool(&ic->bee->set, "strip_html")) {
- strip_html(newmsg);
+ strip_html(msg);
}
/* coloring */
if(set_getbool(&ic->bee->set, "otr_color_encrypted")) {
- /* color according to f'print trust */
- int color;
+ int color; /* color according to f'print trust */
+ char *pre="", *sep=""; /* optional parts */
const char *trust = context->active_fingerprint->trust;
+
if(trust && trust[0] != '\0')
color=3; /* green */
else
color=5; /* red */
- if(newmsg[0] == ',') {
- /* could be a problem with the color code */
- /* insert a space between color spec and message */
- colormsg = g_strdup_printf("\x03%.2d %s\x0F", color, newmsg);
- } else {
- colormsg = g_strdup_printf("\x03%.2d%s\x0F", color, newmsg);
+ /* in a query window, keep "/me " uncolored at the beginning */
+ if(g_strncasecmp(msg, "/me ", 4) == 0
+ && irc_user_msgdest(iu) == irc->user->nick) {
+ msg += 4; /* skip */
+ pre = "/me ";
}
+
+ /* comma in first place could mess with the color code */
+ if(msg[0] == ',') {
+ /* insert a space between color spec and message */
+ sep = " ";
+ }
+
+ msg = g_strdup_printf("%s\x03%.2d%s%s\x0F", pre,
+ color, sep, msg);
}
- } else {
- colormsg = g_strdup(newmsg);
}
+ if(msg == newmsg) {
+ msg = g_strdup(newmsg);
+ }
otrl_message_free(newmsg);
- return colormsg;
+ return msg;
}
}
@@ -430,6 +443,7 @@ char *otr_filter_msg_out(irc_user_t *iu, char *msg, int flags)
{
int st;
char *otrmsg = NULL;
+ char *emsg = msg; /* the message as we hand it to libotr */
ConnContext *ctx = NULL;
irc_t *irc = iu->irc;
struct im_connection *ic = iu->bu->ic;
@@ -439,24 +453,28 @@ char *otr_filter_msg_out(irc_user_t *iu, char *msg, int flags)
return msg;
}
+ ctx = otrl_context_find(irc->otr->us,
+ iu->bu->handle, ic->acc->user, ic->acc->prpl->name,
+ 1, NULL, NULL, NULL);
+
/* HTML encoding */
/* consider OTR plaintext to be HTML if otr_does_html is set */
- if(set_getbool(&ic->bee->set, "otr_does_html") &&
+ if(ctx && ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED &&
+ set_getbool(&ic->bee->set, "otr_does_html") &&
(g_strncasecmp(msg, "<html>", 6) != 0)) {
- msg = escape_html(msg);
+ emsg = escape_html(msg);
}
st = otrl_message_sending(irc->otr->us, &otr_ops, ic,
ic->acc->user, ic->acc->prpl->name, iu->bu->handle,
- msg, NULL, &otrmsg, NULL, NULL);
+ emsg, NULL, &otrmsg, NULL, NULL);
+ if(emsg != msg) {
+ g_free(emsg); /* we're done with this one */
+ }
if(st) {
return NULL;
}
- ctx = otrl_context_find(irc->otr->us,
- iu->bu->handle, ic->acc->user, ic->acc->prpl->name,
- 1, NULL, NULL, NULL);
-
if(otrmsg) {
if(!ctx) {
otrl_message_free(otrmsg);
@@ -503,13 +521,13 @@ static void cmd_otr(irc_t *irc, char **args)
}
if(!cmd->command) {
- irc_usermsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02",
+ irc_rootmsg(irc, "%s: unknown subcommand \"%s\", see \x02help otr\x02",
args[0], args[1]);
return;
}
if(!args[cmd->required_parameters+1]) {
- irc_usermsg(irc, "%s %s: not enough arguments (%d req.)",
+ irc_rootmsg(irc, "%s %s: not enough arguments (%d req.)",
args[0], args[1], cmd->required_parameters);
return;
}
@@ -581,7 +599,7 @@ void op_inject_message(void *opdata, const char *accountname,
if (strcmp(accountname, recipient) == 0) {
/* huh? injecting messages to myself? */
- irc_usermsg(irc, "note to self: %s", message);
+ irc_rootmsg(irc, "note to self: %s", message);
} else {
/* need to drop some consts here :-( */
/* TODO: get flags into op_inject_message?! */
@@ -596,9 +614,15 @@ int op_display_otr_message(void *opdata, const char *accountname,
struct im_connection *ic = check_imc(opdata, accountname, protocol);
char *msg = g_strdup(message);
irc_t *irc = ic->bee->ui_data;
+ irc_user_t *u = peeruser(irc, username, protocol);
strip_html(msg);
- irc_usermsg(irc, "otr: %s", msg);
+ if(u) {
+ /* display as a notice from this particular user */
+ irc_usernotice(u, "%s", msg);
+ } else {
+ irc_rootmsg(irc, "[otr] %s", msg);
+ }
g_free(msg);
return 0;
@@ -610,11 +634,17 @@ void op_new_fingerprint(void *opdata, OtrlUserState us,
{
struct im_connection *ic = check_imc(opdata, accountname, protocol);
irc_t *irc = ic->bee->ui_data;
+ irc_user_t *u = peeruser(irc, username, protocol);
char hunam[45]; /* anybody looking? ;-) */
otrl_privkey_hash_to_human(hunam, fingerprint);
- irc_usermsg(irc, "new fingerprint for %s: %s",
- peernick(irc, username, protocol), hunam);
+ if(u) {
+ irc_usernotice(u, "new fingerprint: %s", hunam);
+ } else {
+ /* this case shouldn't normally happen */
+ irc_rootmsg(irc, "new fingerprint for %s/%s: %s",
+ username, protocol, hunam);
+ }
}
void op_write_fingerprints(void *opdata)
@@ -643,7 +673,7 @@ void op_gone_secure(void *opdata, ConnContext *context)
otr_update_uflags(context, u);
if(!otr_update_modeflags(irc, u)) {
char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!";
- irc_usermsg(irc, "conversation with %s is now off the record (%s)", u->nick, trust);
+ irc_usernotice(u, "conversation is now off the record (%s)", trust);
}
}
@@ -663,7 +693,7 @@ void op_gone_insecure(void *opdata, ConnContext *context)
}
otr_update_uflags(context, u);
if(!otr_update_modeflags(irc, u))
- irc_usermsg(irc, "conversation with %s is now in the clear", u->nick);
+ irc_usernotice(u, "conversation is now in cleartext");
}
void op_still_secure(void *opdata, ConnContext *context, int is_reply)
@@ -684,7 +714,7 @@ void op_still_secure(void *opdata, ConnContext *context, int is_reply)
otr_update_uflags(context, u);
if(!otr_update_modeflags(irc, u)) {
char *trust = u->flags & IRC_USER_OTR_TRUSTED ? "trusted" : "untrusted!";
- irc_usermsg(irc, "otr connection with %s has been refreshed (%s)", u->nick, trust);
+ irc_usernotice(u, "otr connection has been refreshed (%s)", trust);
}
}
@@ -728,7 +758,7 @@ void cmd_otr_disconnect(irc_t *irc, char **args)
u = irc_user_by_name(irc, args[1]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[1]);
+ irc_rootmsg(irc, "%s: unknown user", args[1]);
return;
}
@@ -753,11 +783,11 @@ void cmd_otr_connect(irc_t *irc, char **args)
u = irc_user_by_name(irc, args[1]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[1]);
+ irc_rootmsg(irc, "%s: unknown user", args[1]);
return;
}
if(!(u->bu->flags & BEE_USER_ONLINE)) {
- irc_usermsg(irc, "%s is offline", args[1]);
+ irc_rootmsg(irc, "%s is offline", args[1]);
return;
}
@@ -784,14 +814,14 @@ void cmd_otr_trust(irc_t *irc, char **args)
u = irc_user_by_name(irc, args[1]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[1]);
+ irc_rootmsg(irc, "%s: unknown user", args[1]);
return;
}
ctx = otrl_context_find(irc->otr->us, u->bu->handle,
u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL);
if(!ctx) {
- irc_usermsg(irc, "%s: no otr context with user", args[1]);
+ irc_rootmsg(irc, "%s: no otr context with user", args[1]);
return;
}
@@ -803,18 +833,18 @@ void cmd_otr_trust(irc_t *irc, char **args)
int x, y;
if(!*p || !*q) {
- irc_usermsg(irc, "failed: truncated fingerprint block %d", i+1);
+ irc_rootmsg(irc, "failed: truncated fingerprint block %d", i+1);
return;
}
x = hexval(*p);
y = hexval(*q);
if(x<0) {
- irc_usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1);
+ irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+1, i+1);
return;
}
if(y<0) {
- irc_usermsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1);
+ irc_rootmsg(irc, "failed: %d. hex digit of block %d out of range", 2*j+2, i+1);
return;
}
@@ -823,11 +853,11 @@ void cmd_otr_trust(irc_t *irc, char **args)
}
fp = otrl_context_find_fingerprint(ctx, raw, 0, NULL);
if(!fp) {
- irc_usermsg(irc, "failed: no such fingerprint for %s", args[1]);
+ irc_rootmsg(irc, "failed: no such fingerprint for %s", args[1]);
} else {
char *trust = args[7] ? args[7] : "affirmed";
otrl_context_set_trust(fp, trust);
- irc_usermsg(irc, "fingerprint match, trust set to \"%s\"", trust);
+ irc_rootmsg(irc, "fingerprint match, trust set to \"%s\"", trust);
if(u->flags & IRC_USER_OTR_ENCRYPTED)
u->flags |= IRC_USER_OTR_TRUSTED;
otr_update_modeflags(irc, u);
@@ -855,21 +885,21 @@ void cmd_otr_info(irc_t *irc, char **args)
handle = arg;
ctx = otrl_context_find(irc->otr->us, handle, myhandle, protocol, 0, NULL, NULL, NULL);
if(!ctx) {
- irc_usermsg(irc, "no such context");
+ irc_rootmsg(irc, "no such context");
g_free(arg);
return;
}
} else {
irc_user_t *u = irc_user_by_name(irc, args[1]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[1]);
+ irc_rootmsg(irc, "%s: unknown user", args[1]);
g_free(arg);
return;
}
ctx = otrl_context_find(irc->otr->us, u->bu->handle, u->bu->ic->acc->user,
u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL);
if(!ctx) {
- irc_usermsg(irc, "no otr context with %s", args[1]);
+ irc_rootmsg(irc, "no otr context with %s", args[1]);
g_free(arg);
return;
}
@@ -877,7 +907,7 @@ void cmd_otr_info(irc_t *irc, char **args)
/* show how we resolved the (nick) argument, if we did */
if(handle!=arg) {
- irc_usermsg(irc, "%s is %s/%s; we are %s/%s to them", args[1],
+ irc_rootmsg(irc, "%s is %s/%s; we are %s/%s to them", args[1],
ctx->username, ctx->protocol, ctx->accountname, ctx->protocol);
}
show_otr_context_info(irc, ctx);
@@ -892,19 +922,19 @@ void cmd_otr_keygen(irc_t *irc, char **args)
n = atoi(args[1]);
if(n<0 || (!n && strcmp(args[1], "0"))) {
- irc_usermsg(irc, "%s: invalid account number", args[1]);
+ irc_rootmsg(irc, "%s: invalid account number", args[1]);
return;
}
a = irc->b->accounts;
for(i=0; i<n && a; i++, a=a->next);
if(!a) {
- irc_usermsg(irc, "%s: no such account", args[1]);
+ irc_rootmsg(irc, "%s: no such account", args[1]);
return;
}
if(keygen_in_progress(irc, a->user, a->prpl->name)) {
- irc_usermsg(irc, "keygen for account %d already in progress", n);
+ irc_rootmsg(irc, "keygen for account %d already in progress", n);
return;
}
@@ -926,7 +956,7 @@ void yes_forget_fingerprint(void *data)
g_free(p);
if(fp == fp->context->active_fingerprint) {
- irc_usermsg(irc, "that fingerprint is active, terminate otr connection first");
+ irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first");
return;
}
@@ -942,7 +972,7 @@ void yes_forget_context(void *data)
g_free(p);
if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
- irc_usermsg(irc, "active otr connection with %s, terminate it first",
+ irc_rootmsg(irc, "active otr connection with %s, terminate it first",
peernick(irc, ctx->username, ctx->protocol));
return;
}
@@ -974,21 +1004,21 @@ void cmd_otr_forget(irc_t *irc, char **args)
pair_t *p;
if(!args[3]) {
- irc_usermsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]);
+ irc_rootmsg(irc, "otr %s %s: not enough arguments (2 req.)", args[0], args[1]);
return;
}
/* TODO: allow context specs ("user/proto/account") in 'otr forget fingerprint'? */
u = irc_user_by_name(irc, args[2]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[2]);
+ irc_rootmsg(irc, "%s: unknown user", args[2]);
return;
}
ctx = otrl_context_find(irc->otr->us, u->bu->handle, u->bu->ic->acc->user,
u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL);
if(!ctx) {
- irc_usermsg(irc, "no otr context with %s", args[2]);
+ irc_rootmsg(irc, "no otr context with %s", args[2]);
return;
}
@@ -999,7 +1029,7 @@ void cmd_otr_forget(irc_t *irc, char **args)
}
if(fp == ctx->active_fingerprint) {
- irc_usermsg(irc, "that fingerprint is active, terminate otr connection first");
+ irc_rootmsg(irc, "that fingerprint is active, terminate otr connection first");
return;
}
@@ -1024,19 +1054,19 @@ void cmd_otr_forget(irc_t *irc, char **args)
/* TODO: allow context specs ("user/proto/account") in 'otr forget contex'? */
u = irc_user_by_name(irc, args[2]);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", args[2]);
+ irc_rootmsg(irc, "%s: unknown user", args[2]);
return;
}
ctx = otrl_context_find(irc->otr->us, u->bu->handle, u->bu->ic->acc->user,
u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL);
if(!ctx) {
- irc_usermsg(irc, "no otr context with %s", args[2]);
+ irc_rootmsg(irc, "no otr context with %s", args[2]);
return;
}
if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
- irc_usermsg(irc, "active otr connection with %s, terminate it first", args[2]);
+ irc_rootmsg(irc, "active otr connection with %s, terminate it first", args[2]);
return;
}
@@ -1069,7 +1099,7 @@ void cmd_otr_forget(irc_t *irc, char **args)
else
{
- irc_usermsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",
+ irc_rootmsg(irc, "otr %s: unknown subcommand \"%s\", see \x02help otr forget\x02",
args[0], args[1]);
}
}
@@ -1095,7 +1125,7 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
ic->acc->user, ic->acc->prpl->name, 1, NULL, NULL, NULL);
if(!context) {
/* huh? out of memory or what? */
- irc_usermsg(irc, "smp: failed to get otr context for %s", u->nick);
+ irc_rootmsg(irc, "smp: failed to get otr context for %s", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
return;
@@ -1103,7 +1133,7 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
nextMsg = context->smstate->nextExpected;
if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) {
- irc_usermsg(irc, "smp %s: opponent violated protocol, aborting",
+ irc_rootmsg(irc, "smp %s: opponent violated protocol, aborting",
u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
@@ -1113,14 +1143,14 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q);
if (tlv) {
if (nextMsg != OTRL_SMP_EXPECT1) {
- irc_usermsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick);
+ irc_rootmsg(irc, "smp %s: spurious SMP1Q received, aborting", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
} else {
char *question = g_strndup((char *)tlv->data, tlv->len);
- irc_usermsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,
+ irc_rootmsg(irc, "smp: initiated by %s with question: \x02\"%s\"\x02", u->nick,
question);
- irc_usermsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",
+ irc_rootmsg(irc, "smp: respond with \x02otr smp %s <answer>\x02",
u->nick);
g_free(question);
/* smp stays in EXPECT1 until user responds */
@@ -1129,11 +1159,11 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1);
if (tlv) {
if (nextMsg != OTRL_SMP_EXPECT1) {
- irc_usermsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick);
+ irc_rootmsg(irc, "smp %s: spurious SMP1 received, aborting", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
} else {
- irc_usermsg(irc, "smp: initiated by %s"
+ irc_rootmsg(irc, "smp: initiated by %s"
" - respond with \x02otr smp %s <secret>\x02",
u->nick, u->nick);
/* smp stays in EXPECT1 until user responds */
@@ -1142,7 +1172,7 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);
if (tlv) {
if (nextMsg != OTRL_SMP_EXPECT2) {
- irc_usermsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick);
+ irc_rootmsg(irc, "smp %s: spurious SMP2 received, aborting", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
} else {
@@ -1153,25 +1183,25 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP3);
if (tlv) {
if (nextMsg != OTRL_SMP_EXPECT3) {
- irc_usermsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick);
+ irc_rootmsg(irc, "smp %s: spurious SMP3 received, aborting", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
} else {
/* SMP3 received, otrl_message_receiving will have sent SMP4 */
if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
if(context->smstate->received_question) {
- irc_usermsg(irc, "smp %s: correct answer, you are trusted",
+ irc_rootmsg(irc, "smp %s: correct answer, you are trusted",
u->nick);
} else {
- irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",
+ irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted",
u->nick);
}
} else {
if(context->smstate->received_question) {
- irc_usermsg(irc, "smp %s: wrong answer, you are not trusted",
+ irc_rootmsg(irc, "smp %s: wrong answer, you are not trusted",
u->nick);
} else {
- irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",
+ irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted",
u->nick);
}
}
@@ -1182,16 +1212,16 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP4);
if (tlv) {
if (nextMsg != OTRL_SMP_EXPECT4) {
- irc_usermsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick);
+ irc_rootmsg(irc, "smp %s: spurious SMP4 received, aborting", u->nick);
otrl_message_abort_smp(us, ops, u->bu->ic, context);
otrl_sm_state_free(context->smstate);
} else {
/* SMP4 received, otrl_message_receiving will have set fp trust */
if(context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
- irc_usermsg(irc, "smp %s: secrets proved equal, fingerprint trusted",
+ irc_rootmsg(irc, "smp %s: secrets proved equal, fingerprint trusted",
u->nick);
} else {
- irc_usermsg(irc, "smp %s: secrets did not match, fingerprint not trusted",
+ irc_rootmsg(irc, "smp %s: secrets did not match, fingerprint not trusted",
u->nick);
}
otrl_sm_state_free(context->smstate);
@@ -1200,7 +1230,7 @@ void otr_handle_smp(struct im_connection *ic, const char *handle, OtrlTLV *tlvs)
}
tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
if (tlv) {
- irc_usermsg(irc, "smp: received abort from %s", u->nick);
+ irc_rootmsg(irc, "smp: received abort from %s", u->nick);
otrl_sm_state_free(context->smstate);
/* smp is in back in EXPECT1 */
}
@@ -1215,18 +1245,18 @@ void otr_smp_or_smpq(irc_t *irc, const char *nick, const char *question,
u = irc_user_by_name(irc, nick);
if(!u || !u->bu || !u->bu->ic) {
- irc_usermsg(irc, "%s: unknown user", nick);
+ irc_rootmsg(irc, "%s: unknown user", nick);
return;
}
if(!(u->bu->flags & BEE_USER_ONLINE)) {
- irc_usermsg(irc, "%s is offline", nick);
+ irc_rootmsg(irc, "%s is offline", nick);
return;
}
ctx = otrl_context_find(irc->otr->us, u->bu->handle,
u->bu->ic->acc->user, u->bu->ic->acc->prpl->name, 0, NULL, NULL, NULL);
if(!ctx || ctx->msgstate != OTRL_MSGSTATE_ENCRYPTED) {
- irc_usermsg(irc, "smp: otr inactive with %s, try \x02otr connect"
+ irc_rootmsg(irc, "smp: otr inactive with %s, try \x02otr connect"
" %s\x02", nick, nick);
return;
}
@@ -1241,7 +1271,7 @@ void otr_smp_or_smpq(irc_t *irc, const char *nick, const char *question,
if(question) {
/* this was 'otr smpq', just initiate */
- irc_usermsg(irc, "smp: initiating with %s...", u->nick);
+ irc_rootmsg(irc, "smp: initiating with %s...", u->nick);
otrl_message_initiate_smp_q(irc->otr->us, &otr_ops, u->bu->ic, ctx,
question, (unsigned char *)secret, strlen(secret));
/* smp is now in EXPECT2 */
@@ -1250,14 +1280,14 @@ void otr_smp_or_smpq(irc_t *irc, const char *nick, const char *question,
/* warning: the following assumes that smstates are cleared whenever an SMP
is completed or aborted! */
if(ctx->smstate->secret == NULL) {
- irc_usermsg(irc, "smp: initiating with %s...", u->nick);
+ irc_rootmsg(irc, "smp: initiating with %s...", u->nick);
otrl_message_initiate_smp(irc->otr->us, &otr_ops,
u->bu->ic, ctx, (unsigned char *)secret, strlen(secret));
/* smp is now in EXPECT2 */
} else {
/* if we're still in EXPECT1 but smstate is initialized, we must have
received the SMP1, so let's issue a response */
- irc_usermsg(irc, "smp: responding to %s...", u->nick);
+ irc_rootmsg(irc, "smp: responding to %s...", u->nick);
otrl_message_respond_smp(irc->otr->us, &otr_ops,
u->bu->ic, ctx, (unsigned char *)secret, strlen(secret));
/* smp is now in EXPECT3 */
@@ -1372,13 +1402,13 @@ void show_fingerprints(irc_t *irc, ConnContext *ctx)
trust=fp->trust;
}
if(fp == ctx->active_fingerprint) {
- irc_usermsg(irc, " \x02%s (%s)\x02", human, trust);
+ irc_rootmsg(irc, " \x02%s (%s)\x02", human, trust);
} else {
- irc_usermsg(irc, " %s (%s)", human, trust);
+ irc_rootmsg(irc, " %s (%s)", human, trust);
}
}
if(count==0)
- irc_usermsg(irc, " (none)");
+ irc_rootmsg(irc, " (none)");
}
Fingerprint *match_fingerprint(irc_t *irc, ConnContext *ctx, const char **args)
@@ -1397,14 +1427,14 @@ Fingerprint *match_fingerprint(irc_t *irc, ConnContext *ctx, const char **args)
char c = toupper(args[i][j]);
if(n>=40) {
- irc_usermsg(irc, "too many fingerprint digits given, expected at most 40");
+ irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40");
return NULL;
}
if( (c>='A' && c<='F') || (c>='0' && c<='9') ) {
*(p++) = c;
} else {
- irc_usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);
+ irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);
return NULL;
}
@@ -1425,7 +1455,7 @@ Fingerprint *match_fingerprint(irc_t *irc, ConnContext *ctx, const char **args)
break;
}
if(!fp) {
- irc_usermsg(irc, "%s: no match", prefix);
+ irc_rootmsg(irc, "%s: no match", prefix);
return NULL;
}
@@ -1438,7 +1468,7 @@ Fingerprint *match_fingerprint(irc_t *irc, ConnContext *ctx, const char **args)
break;
}
if(fp2) {
- irc_usermsg(irc, "%s: multiple matches", prefix);
+ irc_rootmsg(irc, "%s: multiple matches", prefix);
return NULL;
}
@@ -1461,14 +1491,14 @@ OtrlPrivKey *match_privkey(irc_t *irc, const char **args)
char c = toupper(args[i][j]);
if(n>=40) {
- irc_usermsg(irc, "too many fingerprint digits given, expected at most 40");
+ irc_rootmsg(irc, "too many fingerprint digits given, expected at most 40");
return NULL;
}
if( (c>='A' && c<='F') || (c>='0' && c<='9') ) {
*(p++) = c;
} else {
- irc_usermsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);
+ irc_rootmsg(irc, "invalid hex digit '%c' in block %d", args[i][j], i+1);
return NULL;
}
@@ -1489,7 +1519,7 @@ OtrlPrivKey *match_privkey(irc_t *irc, const char **args)
break;
}
if(!k) {
- irc_usermsg(irc, "%s: no match", prefix);
+ irc_rootmsg(irc, "%s: no match", prefix);
return NULL;
}
@@ -1502,7 +1532,7 @@ OtrlPrivKey *match_privkey(irc_t *irc, const char **args)
break;
}
if(k2) {
- irc_usermsg(irc, "%s: multiple matches", prefix);
+ irc_rootmsg(irc, "%s: multiple matches", prefix);
return NULL;
}
@@ -1517,16 +1547,16 @@ void show_general_otr_info(irc_t *irc)
kg_t *kg;
/* list all privkeys (including ones being generated) */
- irc_usermsg(irc, "\x1fprivate keys:\x1f");
+ irc_rootmsg(irc, "\x1fprivate keys:\x1f");
for(key=irc->otr->us->privkey_root; key; key=key->next) {
const char *hash;
switch(key->pubkey_type) {
case OTRL_PUBKEY_TYPE_DSA:
- irc_usermsg(irc, " %s/%s - DSA", key->accountname, key->protocol);
+ irc_rootmsg(irc, " %s/%s - DSA", key->accountname, key->protocol);
break;
default:
- irc_usermsg(irc, " %s/%s - type %d", key->accountname, key->protocol,
+ irc_rootmsg(irc, " %s/%s - type %d", key->accountname, key->protocol,
key->pubkey_type);
}
@@ -1535,25 +1565,25 @@ void show_general_otr_info(irc_t *irc)
for hashing a given 'OtrlPrivKey'... */
hash = otrl_privkey_fingerprint(irc->otr->us, human, key->accountname, key->protocol);
if(hash) /* should always succeed */
- irc_usermsg(irc, " %s", human);
+ irc_rootmsg(irc, " %s", human);
}
if(irc->otr->sent_accountname) {
- irc_usermsg(irc, " %s/%s - DSA", irc->otr->sent_accountname,
+ irc_rootmsg(irc, " %s/%s - DSA", irc->otr->sent_accountname,
irc->otr->sent_protocol);
- irc_usermsg(irc, " (being generated)");
+ irc_rootmsg(irc, " (being generated)");
}
for(kg=irc->otr->todo; kg; kg=kg->next) {
- irc_usermsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol);
- irc_usermsg(irc, " (queued)");
+ irc_rootmsg(irc, " %s/%s - DSA", kg->accountname, kg->protocol);
+ irc_rootmsg(irc, " (queued)");
}
if(key == irc->otr->us->privkey_root &&
!irc->otr->sent_accountname &&
kg == irc->otr->todo)
- irc_usermsg(irc, " (none)");
+ irc_rootmsg(irc, " (none)");
/* list all contexts */
- irc_usermsg(irc, "%s", "");
- irc_usermsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)");
+ irc_rootmsg(irc, "%s", "");
+ irc_rootmsg(irc, "\x1f" "connection contexts:\x1f (bold=currently encrypted)");
for(ctx=irc->otr->us->context_root; ctx; ctx=ctx->next) {\
irc_user_t *u;
char *userstring;
@@ -1567,51 +1597,51 @@ void show_general_otr_info(irc_t *irc)
ctx->username, ctx->protocol, ctx->accountname);
if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
- irc_usermsg(irc, " \x02%s\x02", userstring);
+ irc_rootmsg(irc, " \x02%s\x02", userstring);
} else {
- irc_usermsg(irc, " %s", userstring);
+ irc_rootmsg(irc, " %s", userstring);
}
g_free(userstring);
}
if(ctx == irc->otr->us->context_root)
- irc_usermsg(irc, " (none)");
+ irc_rootmsg(irc, " (none)");
}
void show_otr_context_info(irc_t *irc, ConnContext *ctx)
{
switch(ctx->otr_offer) {
case OFFER_NOT:
- irc_usermsg(irc, " otr offer status: none sent");
+ irc_rootmsg(irc, " otr offer status: none sent");
break;
case OFFER_SENT:
- irc_usermsg(irc, " otr offer status: awaiting reply");
+ irc_rootmsg(irc, " otr offer status: awaiting reply");
break;
case OFFER_ACCEPTED:
- irc_usermsg(irc, " otr offer status: accepted our offer");
+ irc_rootmsg(irc, " otr offer status: accepted our offer");
break;
case OFFER_REJECTED:
- irc_usermsg(irc, " otr offer status: ignored our offer");
+ irc_rootmsg(irc, " otr offer status: ignored our offer");
break;
default:
- irc_usermsg(irc, " otr offer status: %d", ctx->otr_offer);
+ irc_rootmsg(irc, " otr offer status: %d", ctx->otr_offer);
}
switch(ctx->msgstate) {
case OTRL_MSGSTATE_PLAINTEXT:
- irc_usermsg(irc, " connection state: cleartext");
+ irc_rootmsg(irc, " connection state: cleartext");
break;
case OTRL_MSGSTATE_ENCRYPTED:
- irc_usermsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version);
+ irc_rootmsg(irc, " connection state: encrypted (v%d)", ctx->protocol_version);
break;
case OTRL_MSGSTATE_FINISHED:
- irc_usermsg(irc, " connection state: shut down");
+ irc_rootmsg(irc, " connection state: shut down");
break;
default:
- irc_usermsg(irc, " connection state: %d", ctx->msgstate);
+ irc_rootmsg(irc, " connection state: %d", ctx->msgstate);
}
- irc_usermsg(irc, " fingerprints: (bold=active)");
+ irc_rootmsg(irc, " fingerprints: (bold=active)");
show_fingerprints(irc, ctx);
}
@@ -1651,20 +1681,20 @@ void otr_keygen(irc_t *irc, const char *handle, const char *protocol)
FILE *tof, *fromf;
if(pipe(to) < 0 || pipe(from) < 0) {
- irc_usermsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno));
+ irc_rootmsg(irc, "otr keygen: couldn't create pipe: %s", strerror(errno));
return;
}
tof = fdopen(to[1], "w");
fromf = fdopen(from[0], "r");
if(!tof || !fromf) {
- irc_usermsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno));
+ irc_rootmsg(irc, "otr keygen: couldn't streamify pipe: %s", strerror(errno));
return;
}
p = fork();
if(p<0) {
- irc_usermsg(irc, "otr keygen: couldn't fork: %s", strerror(errno));
+ irc_rootmsg(irc, "otr keygen: couldn't fork: %s", strerror(errno));
return;
}
@@ -1744,7 +1774,7 @@ gboolean keygen_finish_handler(gpointer data, gint fd, b_input_condition cond)
myfgets(filename, 512, irc->otr->from);
myfgets(msg, 512, irc->otr->from);
- irc_usermsg(irc, "%s", msg);
+ irc_rootmsg(irc, "%s", msg);
if(filename[0]) {
char *kf = g_strdup_printf("%s%s.otr_keys", global.conf->configdir, irc->user->nick);
char *tmp = g_strdup_printf("%s.new", kf);
@@ -1818,12 +1848,14 @@ void yes_keygen(void *data)
irc_t *irc = acc->bee->ui_data;
if(keygen_in_progress(irc, acc->user, acc->prpl->name)) {
- irc_usermsg(irc, "keygen for %s/%s already in progress",
+ irc_rootmsg(irc, "keygen for %s/%s already in progress",
acc->user, acc->prpl->name);
} else {
- irc_usermsg(irc, "starting background keygen for %s/%s",
+ irc_rootmsg(irc, "starting background keygen for %s/%s",
acc->user, acc->prpl->name);
- irc_usermsg(irc, "you will be notified when it completes");
+ irc_rootmsg(irc, "you will be notified when it completes");
otr_keygen(irc, acc->user, acc->prpl->name);
}
}
+
+/* vim: set noet ts=4 sw=4: */
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 8fb85ea7..a44679ce 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -215,9 +215,9 @@ static void serv_got_crap( struct im_connection *ic, char *format, ... )
/* If we found one, include the screenname in the message. */
if( a )
/* FIXME(wilmer): ui_log callback or so */
- irc_usermsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
+ irc_rootmsg( ic->bee->ui_data, "%s(%s) - %s", ic->acc->prpl->name, ic->acc->user, text );
else
- irc_usermsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );
+ irc_rootmsg( ic->bee->ui_data, "%s - %s", ic->acc->prpl->name, text );
g_free( text );
}
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c
index 55678f92..fe0fc35f 100644
--- a/protocols/purple/purple.c
+++ b/protocols/purple/purple.c
@@ -180,7 +180,7 @@ static void purple_init( account_t *acc )
default:
/** No way to talk to the user right now, invent one when
this becomes important.
- irc_usermsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",
+ irc_rootmsg( acc->irc, "Setting with unknown type: %s (%d) Expect stuff to break..\n",
name, purple_account_option_get_type( o ) );
*/
name = NULL;
diff --git a/query.c b/query.c
index 9429f2d2..aa03b8b5 100644
--- a/query.c
+++ b/query.c
@@ -149,7 +149,7 @@ void query_answer( irc_t *irc, query_t *q, int ans )
if( q->ic )
imcb_log( q->ic, "Accepted: %s", q->question );
else
- irc_usermsg( irc, "Accepted: %s", q->question );
+ irc_rootmsg( irc, "Accepted: %s", q->question );
if( q->yes )
q->yes( q->data );
}
@@ -158,7 +158,7 @@ void query_answer( irc_t *irc, query_t *q, int ans )
if( q->ic )
imcb_log( q->ic, "Rejected: %s", q->question );
else
- irc_usermsg( irc, "Rejected: %s", q->question );
+ irc_rootmsg( irc, "Rejected: %s", q->question );
if( q->no )
q->no( q->data );
}
@@ -178,7 +178,7 @@ static void query_display( irc_t *irc, query_t *q )
}
else
{
- irc_usermsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
+ irc_rootmsg( irc, "New request: %s\nYou can use the \2yes\2/\2no\2 commands to accept/reject this request.", q->question );
}
}
diff --git a/root_commands.c b/root_commands.c
index a74d4580..ce412b80 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -41,7 +41,7 @@ void root_command_string( irc_t *irc, char *command )
for( blaat = 0; blaat <= x; blaat ++ ) \
if( cmd[blaat] == NULL ) \
{ \
- irc_usermsg( irc, "Not enough parameters given (need %d).", x ); \
+ irc_rootmsg( irc, "Not enough parameters given (need %d).", x ); \
return y; \
} \
} while( 0 )
@@ -68,7 +68,7 @@ void root_command( irc_t *irc, char *cmd[] )
return;
}
- irc_usermsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
+ irc_rootmsg( irc, "Unknown command: %s. Please use \x02help commands\x02 to get a list of available commands.", cmd[0] );
}
static void cmd_help( irc_t *irc, char **cmd )
@@ -89,12 +89,12 @@ static void cmd_help( irc_t *irc, char **cmd )
if( s )
{
- irc_usermsg( irc, "%s", s );
+ irc_rootmsg( irc, "%s", s );
g_free( s );
}
else
{
- irc_usermsg( irc, "Error opening helpfile." );
+ irc_rootmsg( irc, "Error opening helpfile." );
}
}
@@ -109,7 +109,7 @@ static void cmd_identify( irc_t *irc, char **cmd )
if( irc->status & USTATUS_IDENTIFIED )
{
- irc_usermsg( irc, "You're already logged in." );
+ irc_rootmsg( irc, "You're already logged in." );
return;
}
@@ -127,7 +127,7 @@ static void cmd_identify( irc_t *irc, char **cmd )
}
else if( irc->b->accounts != NULL )
{
- irc_usermsg( irc,
+ irc_rootmsg( irc,
"You're trying to identify yourself, but already have "
"at least one IM account set up. "
"Use \x02identify -noload\x02 or \x02identify -force\x02 "
@@ -137,7 +137,7 @@ static void cmd_identify( irc_t *irc, char **cmd )
if( password == NULL )
{
- irc_usermsg( irc, "About to identify, use /OPER to enter the password" );
+ irc_rootmsg( irc, "About to identify, use /OPER to enter the password" );
irc->status |= OPER_HACK_IDENTIFY;
return;
}
@@ -149,13 +149,13 @@ static void cmd_identify( irc_t *irc, char **cmd )
switch (status) {
case STORAGE_INVALID_PASSWORD:
- irc_usermsg( irc, "Incorrect password" );
+ irc_rootmsg( irc, "Incorrect password" );
break;
case STORAGE_NO_SUCH_USER:
- irc_usermsg( irc, "The nick is (probably) not registered" );
+ irc_rootmsg( irc, "The nick is (probably) not registered" );
break;
case STORAGE_OK:
- irc_usermsg( irc, "Password accepted%s",
+ irc_rootmsg( irc, "Password accepted%s",
load ? ", settings and accounts loaded" : "" );
irc_setpass( irc, password );
irc->status |= USTATUS_IDENTIFIED;
@@ -191,7 +191,7 @@ static void cmd_identify( irc_t *irc, char **cmd )
break;
case STORAGE_OTHER_ERROR:
default:
- irc_usermsg( irc, "Unknown error while loading configuration" );
+ irc_rootmsg( irc, "Unknown error while loading configuration" );
break;
}
}
@@ -214,24 +214,24 @@ static void cmd_register( irc_t *irc, char **cmd )
if( global.conf->authmode == AUTHMODE_REGISTERED )
{
- irc_usermsg( irc, "This server does not allow registering new accounts" );
+ irc_rootmsg( irc, "This server does not allow registering new accounts" );
return;
}
if( cmd[1] == NULL )
{
- irc_usermsg( irc, "About to register, use /OPER to enter the password" );
+ irc_rootmsg( irc, "About to register, use /OPER to enter the password" );
irc->status |= OPER_HACK_REGISTER;
return;
}
switch( storage_save( irc, cmd[1], FALSE ) ) {
case STORAGE_ALREADY_EXISTS:
- irc_usermsg( irc, "Nick is already registered" );
+ irc_rootmsg( irc, "Nick is already registered" );
break;
case STORAGE_OK:
- irc_usermsg( irc, "Account successfully created" );
+ irc_rootmsg( irc, "Account successfully created" );
irc_setpass( irc, cmd[1] );
irc->status |= USTATUS_IDENTIFIED;
irc_umode_set( irc, "+R", 1 );
@@ -244,7 +244,7 @@ static void cmd_register( irc_t *irc, char **cmd )
break;
default:
- irc_usermsg( irc, "Error registering" );
+ irc_rootmsg( irc, "Error registering" );
break;
}
}
@@ -256,19 +256,19 @@ static void cmd_drop( irc_t *irc, char **cmd )
status = storage_remove (irc->user->nick, cmd[1]);
switch (status) {
case STORAGE_NO_SUCH_USER:
- irc_usermsg( irc, "That account does not exist" );
+ irc_rootmsg( irc, "That account does not exist" );
break;
case STORAGE_INVALID_PASSWORD:
- irc_usermsg( irc, "Password invalid" );
+ irc_rootmsg( irc, "Password invalid" );
break;
case STORAGE_OK:
irc_setpass( irc, NULL );
irc->status &= ~USTATUS_IDENTIFIED;
irc_umode_set( irc, "-R", 1 );
- irc_usermsg( irc, "Account `%s' removed", irc->user->nick );
+ irc_rootmsg( irc, "Account `%s' removed", irc->user->nick );
break;
default:
- irc_usermsg( irc, "Error: `%d'", status );
+ irc_rootmsg( irc, "Error: `%d'", status );
break;
}
}
@@ -276,11 +276,11 @@ static void cmd_drop( irc_t *irc, char **cmd )
static void cmd_save( irc_t *irc, char **cmd )
{
if( ( irc->status & USTATUS_IDENTIFIED ) == 0 )
- irc_usermsg( irc, "Please create an account first" );
+ irc_rootmsg( irc, "Please create an account first" );
else if( storage_save( irc, NULL, TRUE ) == STORAGE_OK )
- irc_usermsg( irc, "Configuration saved" );
+ irc_rootmsg( irc, "Configuration saved" );
else
- irc_usermsg( irc, "Configuration could not be saved!" );
+ irc_rootmsg( irc, "Configuration could not be saved!" );
}
static void cmd_showset( irc_t *irc, set_t **head, char *key )
@@ -289,18 +289,18 @@ static void cmd_showset( irc_t *irc, set_t **head, char *key )
char *val;
if( ( val = set_getstr( head, key ) ) )
- irc_usermsg( irc, "%s = `%s'", key, val );
+ irc_rootmsg( irc, "%s = `%s'", key, val );
else if( !( set = set_find( head, key ) ) )
{
- irc_usermsg( irc, "Setting `%s' does not exist.", key );
+ irc_rootmsg( irc, "Setting `%s' does not exist.", key );
if( *head == irc->b->set )
- irc_usermsg( irc, "It might be an account or channel setting. "
+ irc_rootmsg( irc, "It might be an account or channel setting. "
"See \x02help account set\x02 and \x02help channel set\x02." );
}
else if( set->flags & SET_PASSWORD )
- irc_usermsg( irc, "%s = `********' (hidden)", key );
+ irc_rootmsg( irc, "%s = `********' (hidden)", key );
else
- irc_usermsg( irc, "%s is empty", key );
+ irc_rootmsg( irc, "%s is empty", key );
}
typedef set_t** (*cmd_set_findhead)( irc_t*, char* );
@@ -343,9 +343,9 @@ static int cmd_set_real( irc_t *irc, char **cmd, set_t **head, cmd_set_checkflag
Showing these msgs instead gives slightly clearer
feedback. */
if( st )
- irc_usermsg( irc, "Setting changed successfully" );
+ irc_rootmsg( irc, "Setting changed successfully" );
else
- irc_usermsg( irc, "Failed to change setting" );
+ irc_rootmsg( irc, "Failed to change setting" );
}
else
{
@@ -376,12 +376,12 @@ static int cmd_account_set_checkflags( irc_t *irc, set_t *s )
if( a->ic && s && s->flags & ACC_SET_OFFLINE_ONLY )
{
- irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "off" );
+ irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "off" );
return 0;
}
else if( !a->ic && s && s->flags & ACC_SET_ONLINE_ONLY )
{
- irc_usermsg( irc, "This setting can only be changed when the account is %s-line", "on" );
+ irc_rootmsg( irc, "This setting can only be changed when the account is %s-line", "on" );
return 0;
}
@@ -395,7 +395,7 @@ static void cmd_account( irc_t *irc, char **cmd )
if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) )
{
- irc_usermsg( irc, "This server only accepts registered users" );
+ irc_rootmsg( irc, "This server only accepts registered users" );
return;
}
@@ -412,7 +412,7 @@ static void cmd_account( irc_t *irc, char **cmd )
for( a = irc->b->accounts; a; a = a->next )
if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
{
- irc_usermsg( irc, "Enter password for account %s(%s) "
+ irc_rootmsg( irc, "Enter password for account %s(%s) "
"first (use /OPER)", a->prpl->name, a->user );
return;
}
@@ -424,25 +424,25 @@ static void cmd_account( irc_t *irc, char **cmd )
if( prpl == NULL )
{
- irc_usermsg( irc, "Unknown protocol" );
+ irc_rootmsg( irc, "Unknown protocol" );
return;
}
for( a = irc->b->accounts; a; a = a->next )
if( a->prpl == prpl && prpl->handle_cmp( a->user, cmd[3] ) == 0 )
- irc_usermsg( irc, "Warning: You already have an account with "
+ irc_rootmsg( irc, "Warning: You already have an account with "
"protocol `%s' and username `%s'. Are you accidentally "
"trying to add it twice?", prpl->name, cmd[3] );
a = account_add( irc->b, prpl, cmd[3], cmd[4] ? cmd[4] : PASSWORD_PENDING );
if( cmd[5] )
{
- irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' "
+ irc_rootmsg( irc, "Warning: Passing a servername/other flags to `account add' "
"is now deprecated. Use `account set' instead." );
set_setstr( &a->set, "server", cmd[5] );
}
- irc_usermsg( irc, "Account successfully added%s", cmd[4] ? "" :
+ irc_rootmsg( irc, "Account successfully added%s", cmd[4] ? "" :
", now use /OPER to enter the password" );
return;
@@ -452,7 +452,7 @@ static void cmd_account( irc_t *irc, char **cmd )
int i = 0;
if( strchr( irc->umode, 'b' ) )
- irc_usermsg( irc, "Account list:" );
+ irc_rootmsg( irc, "Account list:" );
for( a = irc->b->accounts; a; a = a->next )
{
@@ -467,11 +467,11 @@ static void cmd_account( irc_t *irc, char **cmd )
else
con = "";
- irc_usermsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );
+ irc_rootmsg( irc, "%2d (%s): %s, %s%s", i, a->tag, a->prpl->name, a->user, con );
i ++;
}
- irc_usermsg( irc, "End of account list" );
+ irc_rootmsg( irc, "End of account list" );
return;
}
@@ -483,13 +483,13 @@ static void cmd_account( irc_t *irc, char **cmd )
{
if ( irc->b->accounts )
{
- irc_usermsg( irc, "Trying to get all accounts connected..." );
+ irc_rootmsg( irc, "Trying to get all accounts connected..." );
for( a = irc->b->accounts; a; a = a->next )
if( !a->ic && a->auto_connect )
{
if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
- irc_usermsg( irc, "Enter password for account %s(%s) "
+ irc_rootmsg( irc, "Enter password for account %s(%s) "
"first (use /OPER)", a->prpl->name, a->user );
else
account_on( irc->b, a );
@@ -497,14 +497,14 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
- irc_usermsg( irc, "No accounts known. Use `account add' to add one." );
+ irc_rootmsg( irc, "No accounts known. Use `account add' to add one." );
}
return;
}
else if( len >= 2 && g_strncasecmp( cmd[1], "off", len ) == 0 )
{
- irc_usermsg( irc, "Deactivating all active (re)connections..." );
+ irc_rootmsg( irc, "Deactivating all active (re)connections..." );
for( a = irc->b->accounts; a; a = a->next )
{
@@ -529,7 +529,7 @@ static void cmd_account( irc_t *irc, char **cmd )
g_strcasecmp( cmd[1], "del" ) == 0 ||
( a = account_get( irc->b, cmd[1] ) ) == NULL )
{
- irc_usermsg( irc, "Could not find account `%s'. Note that the syntax "
+ irc_rootmsg( irc, "Could not find account `%s'. Note that the syntax "
"of the account command changed, see \x02help account\x02.", cmd[1] );
return;
@@ -539,20 +539,20 @@ static void cmd_account( irc_t *irc, char **cmd )
{
if( a->ic )
{
- irc_usermsg( irc, "Account is still logged in, can't delete" );
+ irc_rootmsg( irc, "Account is still logged in, can't delete" );
}
else
{
account_del( irc->b, a );
- irc_usermsg( irc, "Account deleted" );
+ irc_rootmsg( irc, "Account deleted" );
}
}
else if( len >= 2 && g_strncasecmp( cmd[2], "on", len ) == 0 )
{
if( a->ic )
- irc_usermsg( irc, "Account already online" );
+ irc_rootmsg( irc, "Account already online" );
else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
- irc_usermsg( irc, "Enter password for account %s(%s) "
+ irc_rootmsg( irc, "Enter password for account %s(%s) "
"first (use /OPER)", a->prpl->name, a->user );
else
account_on( irc->b, a );
@@ -566,11 +566,11 @@ static void cmd_account( irc_t *irc, char **cmd )
else if( a->reconnect )
{
cancel_auto_reconnect( a );
- irc_usermsg( irc, "Reconnect cancelled" );
+ irc_rootmsg( irc, "Reconnect cancelled" );
}
else
{
- irc_usermsg( irc, "Account already offline" );
+ irc_rootmsg( irc, "Account already offline" );
}
}
else if( len >= 1 && g_strncasecmp( cmd[2], "set", len ) == 0 )
@@ -579,7 +579,7 @@ static void cmd_account( irc_t *irc, char **cmd )
}
else
{
- irc_usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );
+ irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "account", cmd[2] );
}
}
@@ -596,19 +596,19 @@ static void cmd_channel( irc_t *irc, char **cmd )
int i = 0;
if( strchr( irc->umode, 'b' ) )
- irc_usermsg( irc, "Channel list:" );
+ irc_rootmsg( irc, "Channel list:" );
for( l = irc->channels; l; l = l->next )
{
irc_channel_t *ic = l->data;
- irc_usermsg( irc, "%2d. %s, %s channel%s", i, ic->name,
+ irc_rootmsg( irc, "%2d. %s, %s channel%s", i, ic->name,
set_getstr( &ic->set, "type" ),
ic->flags & IRC_CHANNEL_JOINED ? " (joined)" : "" );
i ++;
}
- irc_usermsg( irc, "End of channel list" );
+ irc_rootmsg( irc, "End of channel list" );
return;
}
@@ -622,7 +622,7 @@ static void cmd_channel( irc_t *irc, char **cmd )
g_strncasecmp( cmd[1], "set", len ) == 0 )
cmd_set_real( irc, cmd + 1, &ic->set, NULL );
else
- irc_usermsg( irc, "Could not find channel `%s'", cmd[1] );
+ irc_rootmsg( irc, "Could not find channel `%s'", cmd[1] );
return;
}
@@ -639,17 +639,17 @@ static void cmd_channel( irc_t *irc, char **cmd )
if( !( ic->flags & IRC_CHANNEL_JOINED ) &&
ic != ic->irc->default_channel )
{
- irc_usermsg( irc, "Channel %s deleted.", ic->name );
+ irc_rootmsg( irc, "Channel %s deleted.", ic->name );
irc_channel_free( ic );
}
else
- irc_usermsg( irc, "Couldn't remove channel (main channel %s or "
+ irc_rootmsg( irc, "Couldn't remove channel (main channel %s or "
"channels you're still in cannot be deleted).",
irc->default_channel->name );
}
else
{
- irc_usermsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );
+ irc_rootmsg( irc, "Unknown command: %s [...] %s. Please use \x02help commands\x02 to get a list of available commands.", "channel", cmd[1] );
}
}
@@ -667,12 +667,12 @@ static void cmd_add( irc_t *irc, char **cmd )
if( !( a = account_get( irc->b, cmd[1] ) ) )
{
- irc_usermsg( irc, "Invalid account" );
+ irc_rootmsg( irc, "Invalid account" );
return;
}
else if( !( a->ic && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
- irc_usermsg( irc, "That account is not on-line" );
+ irc_rootmsg( irc, "That account is not on-line" );
return;
}
@@ -680,12 +680,12 @@ static void cmd_add( irc_t *irc, char **cmd )
{
if( !nick_ok( cmd[3] ) )
{
- irc_usermsg( irc, "The requested nick `%s' is invalid", cmd[3] );
+ irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] );
return;
}
else if( irc_user_by_name( irc, cmd[3] ) )
{
- irc_usermsg( irc, "The requested nick `%s' already exists", cmd[3] );
+ irc_rootmsg( irc, "The requested nick `%s' already exists", cmd[3] );
return;
}
else
@@ -703,10 +703,10 @@ static void cmd_add( irc_t *irc, char **cmd )
( s = set_getstr( &ic->set, "fill_by" ) ) &&
strcmp( s, "group" ) == 0 &&
( group = set_getstr( &ic->set, "group" ) ) )
- irc_usermsg( irc, "Adding `%s' to contact list (group %s)",
+ irc_rootmsg( irc, "Adding `%s' to contact list (group %s)",
cmd[2], group );
else
- irc_usermsg( irc, "Adding `%s' to contact list", cmd[2] );
+ irc_rootmsg( irc, "Adding `%s' to contact list", cmd[2] );
a->prpl->add_buddy( a->ic, cmd[2], group );
}
@@ -719,7 +719,7 @@ static void cmd_add( irc_t *irc, char **cmd )
be called once the IM server confirms. */
if( ( bu = bee_user_new( irc->b, a->ic, cmd[2], BEE_USER_LOCAL ) ) &&
( iu = bu->ui_data ) )
- irc_usermsg( irc, "Temporarily assigned nickname `%s' "
+ irc_rootmsg( irc, "Temporarily assigned nickname `%s' "
"to contact `%s'", iu->nick, cmd[2] );
}
@@ -733,7 +733,7 @@ static void cmd_remove( irc_t *irc, char **cmd )
if( !( iu = irc_user_by_name( irc, cmd[1] ) ) || !( bu = iu->bu ) )
{
- irc_usermsg( irc, "Buddy `%s' not found", cmd[1] );
+ irc_rootmsg( irc, "Buddy `%s' not found", cmd[1] );
return;
}
s = g_strdup( bu->handle );
@@ -743,7 +743,7 @@ static void cmd_remove( irc_t *irc, char **cmd )
if( g_slist_find( irc->users, iu ) )
bee_user_free( irc->b, bu );
- irc_usermsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
+ irc_rootmsg( irc, "Buddy `%s' (nick %s) removed from contact list", s, cmd[1] );
g_free( s );
return;
@@ -759,7 +759,7 @@ static void cmd_info( irc_t *irc, char **cmd )
irc_user_t *iu = irc_user_by_name( irc, cmd[1] );
if( !iu || !iu->bu )
{
- irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
+ irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
ic = iu->bu->ic;
@@ -767,18 +767,18 @@ static void cmd_info( irc_t *irc, char **cmd )
}
else if( !( a = account_get( irc->b, cmd[1] ) ) )
{
- irc_usermsg( irc, "Invalid account" );
+ irc_rootmsg( irc, "Invalid account" );
return;
}
else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
- irc_usermsg( irc, "That account is not on-line" );
+ irc_rootmsg( irc, "That account is not on-line" );
return;
}
if( !ic->acc->prpl->get_info )
{
- irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
+ irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
@@ -795,31 +795,31 @@ static void cmd_rename( irc_t *irc, char **cmd )
if( iu == NULL )
{
- irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
+ irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
}
else if( del )
{
if( iu->bu )
bee_irc_user_nick_reset( iu );
- irc_usermsg( irc, "Nickname reset to `%s'", iu->nick );
+ irc_rootmsg( irc, "Nickname reset to `%s'", iu->nick );
}
else if( iu == irc->user )
{
- irc_usermsg( irc, "Use /nick to change your own nickname" );
+ irc_rootmsg( irc, "Use /nick to change your own nickname" );
}
else if( !nick_ok( cmd[2] ) )
{
- irc_usermsg( irc, "Nick `%s' is invalid", cmd[2] );
+ irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] );
}
else if( ( old = irc_user_by_name( irc, cmd[2] ) ) && old != iu )
{
- irc_usermsg( irc, "Nick `%s' already exists", cmd[2] );
+ irc_rootmsg( irc, "Nick `%s' already exists", cmd[2] );
}
else
{
if( !irc_user_set_nick( iu, cmd[2] ) )
{
- irc_usermsg( irc, "Error while changing nick" );
+ irc_rootmsg( irc, "Error while changing nick" );
return;
}
@@ -835,7 +835,7 @@ static void cmd_rename( irc_t *irc, char **cmd )
nick_set( iu->bu, cmd[2] );
}
- irc_usermsg( irc, "Nick successfully changed" );
+ irc_rootmsg( irc, "Nick successfully changed" );
}
}
@@ -868,14 +868,14 @@ static void cmd_block( irc_t *irc, char **cmd )
else
format = "%-32.32s %-16.16s";
- irc_usermsg( irc, format, "Handle", "Nickname" );
+ irc_rootmsg( irc, format, "Handle", "Nickname" );
for( l = a->ic->deny; l; l = l->next )
{
bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data );
irc_user_t *iu = bu ? bu->ui_data : NULL;
- irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );
+ irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" );
}
- irc_usermsg( irc, "End of list." );
+ irc_rootmsg( irc, "End of list." );
return;
}
@@ -884,7 +884,7 @@ static void cmd_block( irc_t *irc, char **cmd )
irc_user_t *iu = irc_user_by_name( irc, cmd[1] );
if( !iu || !iu->bu )
{
- irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
+ irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
ic = iu->bu->ic;
@@ -892,24 +892,24 @@ static void cmd_block( irc_t *irc, char **cmd )
}
else if( !( a = account_get( irc->b, cmd[1] ) ) )
{
- irc_usermsg( irc, "Invalid account" );
+ irc_rootmsg( irc, "Invalid account" );
return;
}
else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
- irc_usermsg( irc, "That account is not on-line" );
+ irc_rootmsg( irc, "That account is not on-line" );
return;
}
if( !ic->acc->prpl->add_deny || !ic->acc->prpl->rem_permit )
{
- irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
+ irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
imc_rem_allow( ic, cmd[2] );
imc_add_block( ic, cmd[2] );
- irc_usermsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );
+ irc_rootmsg( irc, "Buddy `%s' moved from allow- to block-list", cmd[2] );
}
}
@@ -928,14 +928,14 @@ static void cmd_allow( irc_t *irc, char **cmd )
else
format = "%-32.32s %-16.16s";
- irc_usermsg( irc, format, "Handle", "Nickname" );
+ irc_rootmsg( irc, format, "Handle", "Nickname" );
for( l = a->ic->permit; l; l = l->next )
{
bee_user_t *bu = bee_user_by_handle( irc->b, a->ic, l->data );
irc_user_t *iu = bu ? bu->ui_data : NULL;
- irc_usermsg( irc, format, l->data, iu ? iu->nick : "(none)" );
+ irc_rootmsg( irc, format, l->data, iu ? iu->nick : "(none)" );
}
- irc_usermsg( irc, "End of list." );
+ irc_rootmsg( irc, "End of list." );
return;
}
@@ -944,7 +944,7 @@ static void cmd_allow( irc_t *irc, char **cmd )
irc_user_t *iu = irc_user_by_name( irc, cmd[1] );
if( !iu || !iu->bu )
{
- irc_usermsg( irc, "Nick `%s' does not exist", cmd[1] );
+ irc_rootmsg( irc, "Nick `%s' does not exist", cmd[1] );
return;
}
ic = iu->bu->ic;
@@ -952,25 +952,25 @@ static void cmd_allow( irc_t *irc, char **cmd )
}
else if( !( a = account_get( irc->b, cmd[1] ) ) )
{
- irc_usermsg( irc, "Invalid account" );
+ irc_rootmsg( irc, "Invalid account" );
return;
}
else if( !( ( ic = a->ic ) && ( a->ic->flags & OPT_LOGGED_IN ) ) )
{
- irc_usermsg( irc, "That account is not on-line" );
+ irc_rootmsg( irc, "That account is not on-line" );
return;
}
if( !ic->acc->prpl->rem_deny || !ic->acc->prpl->add_permit )
{
- irc_usermsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
+ irc_rootmsg( irc, "Command `%s' not supported by this protocol", cmd[0] );
}
else
{
imc_rem_block( ic, cmd[2] );
imc_add_allow( ic, cmd[2] );
- irc_usermsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );
+ irc_rootmsg( irc, "Buddy `%s' moved from block- to allow-list", cmd[2] );
}
}
@@ -997,7 +997,7 @@ static void cmd_yesno( irc_t *irc, char **cmd )
{
if( ( ++times >= 3 ) )
{
- irc_usermsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );
+ irc_rootmsg( irc, "%s", msg[rand()%(sizeof(msg)/sizeof(char*))] );
last_irc = NULL;
times = 0;
return;
@@ -1010,7 +1010,7 @@ static void cmd_yesno( irc_t *irc, char **cmd )
times = 0;
}
- irc_usermsg( irc, "Did I ask you something?" );
+ irc_rootmsg( irc, "Did I ask you something?" );
return;
}
@@ -1020,7 +1020,7 @@ static void cmd_yesno( irc_t *irc, char **cmd )
{
if( sscanf( cmd[1], "%d", &numq ) != 1 )
{
- irc_usermsg( irc, "Invalid query number" );
+ irc_rootmsg( irc, "Invalid query number" );
return;
}
@@ -1030,7 +1030,7 @@ static void cmd_yesno( irc_t *irc, char **cmd )
if( !q )
{
- irc_usermsg( irc, "Uhm, I never asked you something like that..." );
+ irc_rootmsg( irc, "Uhm, I never asked you something like that..." );
return;
}
}
@@ -1070,7 +1070,7 @@ static void cmd_blist( irc_t *irc, char **cmd )
else
format = "%-16.16s %-40.40s %s";
- irc_usermsg( irc, format, "Nick", "Handle/Account", "Status" );
+ irc_rootmsg( irc, format, "Nick", "Handle/Account", "Status" );
if( irc->root->last_channel &&
strcmp( set_getstr( &irc->root->last_channel->set, "type" ), "control" ) != 0 )
@@ -1093,7 +1093,7 @@ static void cmd_blist( irc_t *irc, char **cmd )
g_snprintf( st, sizeof( st ) - 1, "Online (%s)", bu->status_msg );
g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
- irc_usermsg( irc, format, iu->nick, s, st );
+ irc_rootmsg( irc, format, iu->nick, s, st );
}
n_online ++;
@@ -1111,7 +1111,7 @@ static void cmd_blist( irc_t *irc, char **cmd )
if( away == 1 )
{
g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
- irc_usermsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );
+ irc_rootmsg( irc, format, iu->nick, s, irc_user_get_away( iu ) );
}
n_away ++;
}
@@ -1128,12 +1128,12 @@ static void cmd_blist( irc_t *irc, char **cmd )
if( offline == 1 )
{
g_snprintf( s, sizeof( s ) - 1, "%s %s(%s)", bu->handle, bu->ic->acc->prpl->name, bu->ic->acc->user );
- irc_usermsg( irc, format, iu->nick, s, "Offline" );
+ irc_rootmsg( irc, format, iu->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 );
+ irc_rootmsg( irc, "%d buddies (%d available, %d away, %d offline)", n_online + n_away + n_offline, n_online, n_away, n_offline );
}
static void cmd_qlist( irc_t *irc, char **cmd )
@@ -1143,17 +1143,17 @@ static void cmd_qlist( irc_t *irc, char **cmd )
if( !q )
{
- irc_usermsg( irc, "There are no pending questions." );
+ irc_rootmsg( irc, "There are no pending questions." );
return;
}
- irc_usermsg( irc, "Pending queries:" );
+ irc_rootmsg( irc, "Pending queries:" );
for( num = 0; q; q = q->next, num ++ )
if( q->ic ) /* Not necessary yet, but it might come later */
- irc_usermsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );
+ irc_rootmsg( irc, "%d, %s(%s): %s", num, q->ic->acc->prpl->name, q->ic->acc->user, q->question );
else
- irc_usermsg( irc, "%d, BitlBee: %s", num, q->question );
+ irc_rootmsg( irc, "%d, BitlBee: %s", num, q->question );
}
static void cmd_chat( irc_t *irc, char **cmd )
@@ -1169,12 +1169,12 @@ static void cmd_chat( irc_t *irc, char **cmd )
if( !( acc = account_get( irc->b, cmd[2] ) ) )
{
- irc_usermsg( irc, "Invalid account" );
+ irc_rootmsg( irc, "Invalid account" );
return;
}
else if( !acc->prpl->chat_join )
{
- irc_usermsg( irc, "Named chatrooms not supported on that account." );
+ irc_rootmsg( irc, "Named chatrooms not supported on that account." );
return;
}
@@ -1204,14 +1204,14 @@ static void cmd_chat( irc_t *irc, char **cmd )
set_setstr( &ic->set, "account", cmd[2] ) &&
set_setstr( &ic->set, "room", cmd[3] ) )
{
- irc_usermsg( irc, "Chatroom successfully added." );
+ irc_rootmsg( irc, "Chatroom successfully added." );
}
else
{
if( ic )
irc_channel_free( ic );
- irc_usermsg( irc, "Could not add chatroom." );
+ irc_rootmsg( irc, "Could not add chatroom." );
}
g_free( channel );
}
@@ -1226,25 +1226,25 @@ static void cmd_chat( irc_t *irc, char **cmd )
{
if( !iu->bu->ic->acc->prpl->chat_with( iu->bu->ic, iu->bu->handle ) )
{
- irc_usermsg( irc, "(Possible) failure while trying to open "
+ irc_rootmsg( irc, "(Possible) failure while trying to open "
"a groupchat with %s.", iu->nick );
}
}
else
{
- irc_usermsg( irc, "Can't open a groupchat with %s.", cmd[2] );
+ irc_rootmsg( irc, "Can't open a groupchat with %s.", cmd[2] );
}
}
else if( g_strcasecmp( cmd[1], "list" ) == 0 ||
g_strcasecmp( cmd[1], "set" ) == 0 ||
g_strcasecmp( cmd[1], "del" ) == 0 )
{
- irc_usermsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );
+ irc_rootmsg( irc, "Warning: The \002chat\002 command was mostly replaced with the \002channel\002 command." );
cmd_channel( irc, cmd );
}
else
{
- irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
+ irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "chat", cmd[1] );
}
}
@@ -1259,18 +1259,18 @@ static void cmd_group( irc_t *irc, char **cmd )
int n = 0;
if( strchr( irc->umode, 'b' ) )
- irc_usermsg( irc, "Group list:" );
+ irc_rootmsg( irc, "Group list:" );
for( l = irc->b->groups; l; l = l->next )
{
bee_group_t *bg = l->data;
- irc_usermsg( irc, "%d. %s", n ++, bg->name );
+ irc_rootmsg( irc, "%d. %s", n ++, bg->name );
}
- irc_usermsg( irc, "End of group list" );
+ irc_rootmsg( irc, "End of group list" );
}
else
{
- irc_usermsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );
+ irc_rootmsg( irc, "Unknown command: %s %s. Please use \x02help commands\x02 to get a list of available commands.", "group", cmd[1] );
}
}
@@ -1283,7 +1283,7 @@ static void cmd_transfer( irc_t *irc, char **cmd )
if( !files )
{
- irc_usermsg( irc, "No pending transfers" );
+ irc_rootmsg( irc, "No pending transfers" );
return;
}
@@ -1304,7 +1304,7 @@ static void cmd_transfer( irc_t *irc, char **cmd )
switch( subcmd ) {
case LIST:
if ( file->status == FT_STATUS_LISTENING )
- irc_usermsg( irc,
+ irc_rootmsg( irc,
"Pending file(id %d): %s (Listening...)", file->local_id, file->file_name);
else
{
@@ -1313,7 +1313,7 @@ static void cmd_transfer( irc_t *irc, char **cmd )
if ( ( file->started > 0 ) && ( file->bytes_transferred > 0 ) )
kb_per_s = file->bytes_transferred / 1024 / diff;
- irc_usermsg( irc,
+ irc_rootmsg( irc,
"Pending file(id %d): %s (%10zd/%zd kb, %d kb/s)", file->local_id, file->file_name,
file->bytes_transferred/1024, file->file_size/1024, kb_per_s);
}
@@ -1321,14 +1321,14 @@ static void cmd_transfer( irc_t *irc, char **cmd )
case REJECT:
if( file->status == FT_STATUS_LISTENING )
{
- irc_usermsg( irc, "Rejecting file transfer for %s", file->file_name );
+ irc_rootmsg( irc, "Rejecting file transfer for %s", file->file_name );
imcb_file_canceled( file->ic, file, "Denied by user" );
}
break;
case CANCEL:
if( file->local_id == fid )
{
- irc_usermsg( irc, "Canceling file transfer for %s", file->file_name );
+ irc_rootmsg( irc, "Canceling file transfer for %s", file->file_name );
imcb_file_canceled( file->ic, file, "Canceled by user" );
}
break;
@@ -1338,7 +1338,7 @@ static void cmd_transfer( irc_t *irc, char **cmd )
static void cmd_nick( irc_t *irc, char **cmd )
{
- irc_usermsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );
+ irc_rootmsg( irc, "This command is deprecated. Try: account %s set display_name", cmd[1] );
}
/* Maybe this should be a stand-alone command as well? */
@@ -1353,7 +1353,7 @@ static void bitlbee_whatsnew( irc_t *irc )
msg = help_get_whatsnew( &(global.help), last );
if( msg )
- irc_usermsg( irc, "%s: This seems to be your first time using this "
+ irc_rootmsg( irc, "%s: This seems to be your first time using this "
"this version of BitlBee. Here's a list of new "
"features you may like to know about:\n\n%s\n",
irc->user->nick, msg );
diff --git a/storage_xml.c b/storage_xml.c
index 042dcaae..af77190e 100644
--- a/storage_xml.c
+++ b/storage_xml.c
@@ -268,7 +268,7 @@ static void xml_start_element( GMarkupParseContext *ctx, const gchar *element_na
else
{
xd->unknown_tag ++;
- irc_usermsg( irc, "Warning: Unknown XML tag found in configuration file (%s). "
+ irc_rootmsg( irc, "Warning: Unknown XML tag found in configuration file (%s). "
"This may happen when downgrading BitlBee versions. "
"This tag will be skipped and the information will be lost "
"once you save your settings.", element_name );
@@ -396,7 +396,7 @@ static storage_status_t xml_load_real( irc_t *irc, const char *my_nick, const ch
else
{
if( gerr && irc )
- irc_usermsg( irc, "Error from XML-parser: %s", gerr->message );
+ irc_rootmsg( irc, "Error from XML-parser: %s", gerr->message );
g_clear_error( &gerr );
return STORAGE_OTHER_ERROR;
@@ -472,7 +472,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite )
strcat( path, ".XXXXXX" );
if( ( fd = mkstemp( path ) ) < 0 )
{
- irc_usermsg( irc, "Error while opening configuration file." );
+ irc_rootmsg( irc, "Error while opening configuration file." );
return STORAGE_OTHER_ERROR;
}
@@ -569,7 +569,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite )
path2 = g_strndup( path, strlen( path ) - 7 );
if( rename( path, path2 ) != 0 )
{
- irc_usermsg( irc, "Error while renaming temporary configuration file." );
+ irc_rootmsg( irc, "Error while renaming temporary configuration file." );
g_free( path2 );
unlink( path );
@@ -584,7 +584,7 @@ static storage_status_t xml_save( irc_t *irc, int overwrite )
write_error:
g_free( pass_buf );
- irc_usermsg( irc, "Write error. Disk full?" );
+ irc_rootmsg( irc, "Write error. Disk full?" );
close( fd );
return STORAGE_OTHER_ERROR;