static int is_hilight (char *from, char *text, session *sess, server *serv) { if (alert_match_word (from, prefs.hex_irc_no_hilight)) return 0; text = strip_color (text, -1, STRIP_ALL); if (alert_match_text (text, serv->nick) || alert_match_text (text, prefs.hex_irc_extra_hilight) || alert_match_word (from, prefs.hex_irc_nick_hilight)) { g_free (text); if (sess != current_tab) { sess->nick_said = TRUE; lastact_update (sess); } fe_set_hilight (sess); return 1; } g_free (text); return 0; }
void inbound_chanmsg (server *serv, session *sess, char *chan, char *from, char *text, char fromme, int id) { struct User *user; int hilight = FALSE; char nickchar[2] = "\000"; char idtext[64]; if (!sess) { if (chan) { sess = find_channel (serv, chan); if (!sess && !is_channel (serv, chan)) sess = find_dialog (serv, chan); } else { sess = find_dialog (serv, from); } if (!sess) return; } if (sess != current_tab) { sess->msg_said = TRUE; sess->new_data = FALSE; lastact_update (sess); } user = userlist_find (sess, from); if (user) { if (user->account) id = TRUE; nickchar[0] = user->prefix[0]; user->lasttalk = time (0); } if (fromme) { if (prefs.hex_away_auto_unmark && serv->is_away) sess->server->p_set_back (sess->server); EMIT_SIGNAL (XP_TE_UCHANMSG, sess, from, text, nickchar, NULL, 0); return; } inbound_make_idtext (serv, idtext, sizeof (idtext), id); if (is_hilight (from, text, sess, serv)) hilight = TRUE; if (sess->type == SESS_DIALOG) EMIT_SIGNAL (XP_TE_DPRIVMSG, sess, from, text, idtext, NULL, 0); else if (hilight) EMIT_SIGNAL (XP_TE_HCHANMSG, sess, from, text, nickchar, idtext, 0); else EMIT_SIGNAL (XP_TE_CHANMSG, sess, from, text, nickchar, idtext, 0); }
static void inbound_privmsg_helper(char *nickchar, char *prefixchar, char *idtext, int *is_highlight, msg_destination *action_type, session **initial_session, server *serv, char **chan, char *from, char *ip, char *text, int *from_me, int *id, const message_tags_data *tags_data) { struct User *user; session *sess = *initial_session; if (*from_me && sess == NULL) { *action_type = MSGDEST_DIRECT; sess = serv->front_session; } else if (*chan && is_channel (serv, *chan)) { *action_type = MSGDEST_CHANNEL; sess = find_channel (serv, *chan); } else if (*chan && strchr(serv->nick_prefixes, **chan) && is_channel (serv, *chan + 1)) { *action_type = MSGDEST_PREFIX; prefixchar[0] = **chan; ++*chan; sess = find_channel (serv, *chan); } else { char *target = *from_me ? *chan : from; session *userquery = find_dialog (serv, target); if (!userquery) { if (prefs.hex_gui_autoopen_dialog && flood_check (target, ip, serv, current_sess, 1)) { *action_type = MSGDEST_PRIVATE; sess = inbound_open_dialog (serv, target, tags_data); } else { *action_type = MSGDEST_DIRECT; sess = serv->front_session; } } else { *action_type = MSGDEST_PRIVATE; sess = userquery; } } *is_highlight = is_hilight (from, text, sess, serv); if (sess != current_tab) { if (*from_me) { sess->msg_said = FALSE; sess->new_data = TRUE; } else { sess->msg_said = TRUE; sess->new_data = FALSE; } lastact_update (sess); } user = userlist_find (sess, from); if (user) { nickchar[0] = user->prefix[0]; user->lasttalk = time (0); if (user->account) *id = TRUE; if (user->me) *from_me = TRUE; } inbound_make_idtext (serv, idtext, sizeof (idtext), *id); *initial_session = sess; }
void inbound_action (session *sess, char *chan, char *from, char *ip, char *text, int fromme, int id, const message_tags_data *tags_data) { session *def = sess; server *serv = sess->server; struct User *user; char nickchar[2] = "\000"; char idtext[64]; int privaction = FALSE; if (!fromme) { if (is_channel (serv, chan)) { sess = find_channel (serv, chan); } else { /* it's a private action! */ privaction = TRUE; /* find a dialog tab for it */ sess = find_dialog (serv, from); /* if non found, open a new one */ if (!sess && prefs.hex_gui_autoopen_dialog) { /* but only if it wouldn't flood */ if (flood_check (from, ip, serv, current_sess, 1)) sess = inbound_open_dialog (serv, from, tags_data); else sess = serv->server_session; } if (!sess) { sess = find_session_from_nick (from, serv); /* still not good? */ if (!sess) sess = serv->front_session; } } } if (!sess) sess = def; if (sess != current_tab) { if (fromme) { sess->msg_said = FALSE; sess->new_data = TRUE; } else { sess->msg_said = TRUE; sess->new_data = FALSE; } lastact_update (sess); } user = userlist_find (sess, from); if (user) { nickchar[0] = user->prefix[0]; user->lasttalk = time (0); if (user->account) id = TRUE; if (user->me) fromme = TRUE; } inbound_make_idtext (serv, idtext, sizeof (idtext), id); if (!fromme && !privaction) { if (is_hilight (from, text, sess, serv)) { EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANACTION, sess, from, text, nickchar, idtext, 0, tags_data->timestamp); return; } } if (fromme) EMIT_SIGNAL_TIMESTAMP (XP_TE_UACTION, sess, from, text, nickchar, idtext, 0, tags_data->timestamp); else if (!privaction) EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANACTION, sess, from, text, nickchar, idtext, 0, tags_data->timestamp); else if (sess->type == SESS_DIALOG) EMIT_SIGNAL_TIMESTAMP (XP_TE_DPRIVACTION, sess, from, text, idtext, NULL, 0, tags_data->timestamp); else EMIT_SIGNAL_TIMESTAMP (XP_TE_PRIVACTION, sess, from, text, idtext, NULL, 0, tags_data->timestamp); }