aboutsummaryrefslogtreecommitdiffstats
path: root/irc_im.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2011-12-17 14:50:01 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2011-12-17 14:50:01 +0100
commit6e9ae727bcd95eb820fa28becaf9f79ac463de5f (patch)
tree2d1d2a0f511d1356caf4a3f7c29c1578f0583a95 /irc_im.c
parent87dddee3a14d7755204d6fc4b321729bad02ce4e (diff)
parent17f057d70b1513710e3d765969205625f0fc7b76 (diff)
Mainline merge.
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 986693aa..a883d467 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 )
@@ -994,7 +985,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;
}