Changes in irc_im.c [5f74987:e67e513]
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r5f74987 re67e513 193 193 } 194 194 195 static void bee_irc_msg_from_user( irc_user_t *iu, const char *msg, time_t sent_at ) 196 { 197 irc_t *irc = iu->irc; 198 bee_t *bee = irc->b; 199 const char *dst; 200 char *prefix = NULL; 201 char *wrapped, *ts = NULL; 202 203 if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) ) 204 ts = irc_format_timestamp( irc, sent_at ); 205 206 dst = irc_user_msgdest(iu); 207 if(dst != irc->user->nick) { 208 /* if not messaging directly, call user by name */ 209 prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" ); 210 } else { 211 prefix = ts; 212 ts = NULL; /* don't doulbe-free */ 213 } 214 215 wrapped = word_wrap( msg, 425 ); 216 irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix ); 217 218 g_free( wrapped ); 219 g_free( prefix ); 220 g_free( ts ); 221 } 222 195 223 static gboolean bee_irc_user_msg( bee_t *bee, bee_user_t *bu, const char *msg_, time_t sent_at ) 196 224 { 197 irc_t *irc = bee->ui_data;198 225 irc_user_t *iu = (irc_user_t *) bu->ui_data; 199 char *dst, *prefix = NULL;200 char *wrapped, *ts = NULL;201 irc_channel_t *ic = NULL;202 226 char *msg = g_strdup( msg_ ); 203 227 GSList *l; 204 205 if( sent_at > 0 && set_getbool( &irc->b->set, "display_timestamps" ) )206 ts = irc_format_timestamp( irc, sent_at );207 208 /* Too similar to irc_usermsg()... */209 if( iu->last_channel )210 {211 if( iu->last_channel->flags & IRC_CHANNEL_JOINED )212 ic = iu->last_channel;213 else214 ic = irc_channel_with_user( irc, iu );215 }216 217 if( ic )218 {219 dst = ic->name;220 prefix = g_strdup_printf( "%s%s%s", irc->user->nick, set_getstr( &bee->set, "to_char" ), ts ? : "" );221 }222 else223 {224 dst = irc->user->nick;225 prefix = ts;226 ts = NULL;227 }228 228 229 229 for( l = irc_plugins; l; l = l->next ) … … 256 256 } 257 257 258 wrapped = word_wrap( msg, 425 ); 259 irc_send_msg( iu, "PRIVMSG", dst, wrapped, prefix ); 260 261 g_free( wrapped ); 262 g_free( prefix ); 258 bee_irc_msg_from_user( iu, msg, sent_at ); 259 263 260 g_free( msg ); 264 g_free( ts );265 266 261 return TRUE; 267 262 } … … 993 988 else if( !acc->prpl->chat_join ) 994 989 { 995 irc_ usermsg( ic->irc, "Named chatrooms not supported on that account." );990 irc_rootmsg( ic->irc, "Named chatrooms not supported on that account." ); 996 991 return SET_INVALID; 997 992 }
Note: See TracChangeset
for help on using the changeset viewer.