aboutsummaryrefslogtreecommitdiffstats
path: root/irc_send.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-27 14:05:38 -0400
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-27 14:05:38 -0400
commit74f1cdef999356e40e3fa3b6a2d89876b6c0c303 (patch)
tree2e8c30033bc9358dd5a0cc4c7ba68ecc9ad992d2 /irc_send.c
parent280c56a7b24dc08b35a1ecd98c8f4b61435d1100 (diff)
irc_usermsg() works a little bit again. Have to figure out how and where
to restore multiline support though.
Diffstat (limited to 'irc_send.c')
-rw-r--r--irc_send.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/irc_send.c b/irc_send.c
index 23298ef4..e93b2b6f 100644
--- a/irc_send.c
+++ b/irc_send.c
@@ -108,18 +108,33 @@ void irc_send_motd( irc_t *irc )
}
}
-/* FIXME/REPLACEME */
void irc_usermsg( irc_t *irc, char *format, ... )
{
+ irc_channel_t *ic;
+ irc_user_t *iu;
char text[1024];
va_list params;
- //irc_user_t *iu;
va_start( params, format );
g_vsnprintf( text, sizeof( text ), format, params );
va_end( params );
- fprintf( stderr, "%s\n", text );
+ if( irc->last_root_cmd &&
+ irc_channel_name_ok( irc->last_root_cmd ) &&
+ ( ic = irc_channel_by_name( irc, irc->last_root_cmd ) ) &&
+ ic->flags & IRC_CHANNEL_JOINED )
+ irc_send_msg( irc->root, "PRIVMSG", irc->last_root_cmd, text );
+ else if( irc->last_root_cmd &&
+ ( iu = irc_user_by_name( irc, irc->last_root_cmd ) ) &&
+ iu->f == &irc_user_root_funcs )
+ irc_send_msg( iu, "PRIVMSG", irc->user->nick, text );
+ else
+ {
+ g_free( irc->last_root_cmd );
+ irc->last_root_cmd = NULL;
+
+ irc_send_msg( irc->root, "PRIVMSG", irc->user->nick, text );
+ }
/*return( irc_msgfrom( irc, u->nick, text ) );*/
}