aboutsummaryrefslogtreecommitdiffstats
path: root/irc_im.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-10-20 23:00:54 -0400
committerWilmer van der Gaast <wilmer@gaast.net>2011-10-20 23:00:54 -0400
commit3864c0814cc3e86a8035d27558f6d66af836a5a3 (patch)
tree096e09b8961ef849f9a82b507012de94f99ea51d /irc_im.c
parent6a451817589df092ef5121bbe2c7156d2d01f669 (diff)
parentaea22cd1e0e955848c143a8fc36978391e9a4846 (diff)
Big merge from pesco, closing some OTR issues: #759, #824, #839, #830.
Diffstat (limited to 'irc_im.c')
-rw-r--r--irc_im.c23
1 files changed, 7 insertions, 16 deletions
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;
}