aboutsummaryrefslogtreecommitdiffstats
path: root/irc_im.c
diff options
context:
space:
mode:
Diffstat (limited to 'irc_im.c')
-rw-r--r--irc_im.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/irc_im.c b/irc_im.c
index 6add08dd..4c43add3 100644
--- a/irc_im.c
+++ b/irc_im.c
@@ -192,16 +192,14 @@ void bee_irc_channel_update( irc_t *irc, irc_channel_t *ic, irc_user_t *iu )
}
}
-static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at )
+void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at )
{
- irc_t *irc = bee->ui_data;
- irc_user_t *iu = (irc_user_t *) bu->ui_data;
+ irc_t *irc = iu->irc;
+ bee_t *bee = irc->b;
+ irc_channel_t *ic = NULL;
char *dst, *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 );
@@ -226,6 +224,20 @@ static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_,
ts = NULL;
}
+ wrapped = word_wrap( msg, 425 );
+ irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
+
+ g_free( wrapped );
+ g_free( prefix );
+ g_free( ts );
+}
+
+static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at )
+{
+ irc_user_t *iu = (irc_user_t *) bu->ui_data;
+ char *msg = g_strdup( msg_ );
+ GSList *l;
+
for( l = irc_plugins; l; l = l->next )
{
irc_plugin_t *p = l->data;
@@ -255,14 +267,9 @@ static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_,
msg = s;
}
- wrapped = word_wrap( msg, 425 );
- irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix );
-
- g_free( wrapped );
- g_free( prefix );
+ bee_irc_msg_from_user( iu, msg, sent_at );
+
g_free( msg );
- g_free( ts );
-
return TRUE;
}