static void sig_message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target) { CHANNEL_REC *channel; int own; channel = channel_find(server, target); if (channel != NULL) { own = nick_match_msg(channel, msg, server->nick); CHANNEL_LAST_MSG_ADD(channel, nick, own); } }
static void sig_message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target) { CHANNEL_REC *channel; GSList **list; channel = channel_find(server, target); if (channel != NULL) { list = nick_match_msg(server, msg, server->nick) ? &channel->lastownmsgs : &channel->lastmsgs; last_msg_add(list, nick); } }
/* check if `text' contains ignored nick at the start of the line. */ static int ignore_check_replies_rec(IGNORE_REC *rec, CHANNEL_REC *channel, const char *text) { GSList *nicks, *tmp; nicks = nicklist_find_multiple(channel, rec->mask); if (nicks == NULL) return FALSE; for (tmp = nicks; tmp != NULL; tmp = tmp->next) { NICK_REC *nick = tmp->data; if (nick_match_msg(channel, text, nick->nick)) return TRUE; } g_slist_free(nicks); return FALSE; }
static void message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target) { CFStringRef desc, title; // int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick) CHANNEL_REC *chanrec; chanrec = channel_find(server, target); g_return_if_fail(chanrec != NULL); if (nick_match_msg(chanrec, msg, server->nick) == FALSE) return; title = CFStringCreateWithCString(kCFAllocatorDefault, chanrec->name, kCFStringEncodingUTF8); desc = CFStringCreateWithCString(kCFAllocatorDefault, msg, kCFStringEncodingUTF8); Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext(title, desc, NOTIFICATION_NAME, NULL, 0, FALSE, NULL); CFSafeRelease(title); CFSafeRelease(desc); }
static void sig_message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target, NICK_REC *nickrec) { CHANNEL_REC *chanrec; const char *printnick; int for_me, print_channel, level; char *nickmode, *color, *freemsg = NULL; HILIGHT_REC *hilight; TEXT_DEST_REC dest; /* NOTE: this may return NULL if some channel is just closed with /WINDOW CLOSE and server still sends the few last messages */ chanrec = channel_find(server, target); if (nickrec == NULL && chanrec != NULL) nickrec = nicklist_find(chanrec, nick); for_me = !settings_get_bool("hilight_nick_matches") ? FALSE : !settings_get_bool("hilight_nick_matches_everywhere") ? nick_match_msg(chanrec, msg, server->nick) : nick_match_msg_everywhere(chanrec, msg, server->nick); hilight = for_me ? NULL : hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg); color = (hilight == NULL) ? NULL : hilight_get_color(hilight); print_channel = chanrec == NULL || !window_item_is_active((WI_ITEM_REC *) chanrec); if (!print_channel && settings_get_bool("print_active_channel") && window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL) print_channel = TRUE; level = MSGLEVEL_PUBLIC; if (for_me) level |= MSGLEVEL_HILIGHT; ignore_check_plus(server, nick, address, target, msg, &level, FALSE); if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg); /* get nick mode & nick what to print the msg with (in case there's multiple identical nicks) */ nickmode = channel_get_nickmode_rec(nickrec); printnick = nickrec == NULL ? nick : g_hash_table_lookup(printnicks, nickrec); if (printnick == NULL) printnick = nick; format_create_dest(&dest, server, target, level, NULL); dest.address = address; dest.nick = nick; if (color != NULL) { /* highlighted nick */ hilight_update_text_dest(&dest,hilight); if (!print_channel) /* message to active channel in window */ printformat_dest(&dest, TXT_PUBMSG_HILIGHT, color, printnick, msg, nickmode); else /* message to not existing/active channel */ printformat_dest(&dest, TXT_PUBMSG_HILIGHT_CHANNEL, color, printnick, target, msg, nickmode); } else { if (!print_channel) printformat_dest(&dest, for_me ? TXT_PUBMSG_ME : TXT_PUBMSG, printnick, msg, nickmode); else printformat_dest(&dest, for_me ? TXT_PUBMSG_ME_CHANNEL : TXT_PUBMSG_CHANNEL, printnick, target, msg, nickmode); } g_free_not_null(nickmode); g_free_not_null(freemsg); g_free_not_null(color); }
/* * Print a message using the public message format (to channel) * Can be from others or ourselves */ void print_message_public(SERVER_REC* server_rec, CHANNEL_REC* channel_rec, char* target, char* nick, char* address, char* msg) { // See fe-common/core/fe-messages.c, sig_message_public() // and fe-common/irc/fe-irc-messages.c, sig_message_irc_op_public() // for the below. char* nickmode = channel_get_nickmode(channel_rec, nick); // Check if hilight by someone referring to me int for_me = nick_match_msg(channel_rec, msg, server_rec->nick); // Also can hilight based on address? int hilight; if (address != NULL) { hilight = for_me || hilight_match_nick(server_rec, target, nick, address, MSGLEVEL_PUBLIC, msg); } else { hilight = for_me; } // If channel is active, we don't need to use the format which includes // channel name, such as <@nick:#channel> int should_print_channel = channel_rec == NULL || !window_item_is_active((WI_ITEM_REC*) channel_rec); // Check if it was us that said this int from_me = strcmp(nick, server_rec->nick) == 0; // Fix up the message level int msg_level = MSGLEVEL_PUBLIC; // We don't want to hilight ourselves if (!from_me && hilight) { msg_level |= MSGLEVEL_HILIGHT; } if (should_print_channel) { if (from_me) { printformat_module("fe-common/core", server_rec, target, msg_level, TXT_OWN_MSG_CHANNEL, nick, target, msg, nickmode); } else { printformat_module("fe-common/core", server_rec, target, msg_level, hilight ? TXT_PUBMSG_ME_CHANNEL : TXT_PUBMSG_CHANNEL, nick, target, msg, nickmode); } } else { if (from_me) { printformat_module("fe-common/core", server_rec, target, msg_level, TXT_OWN_MSG, nick, msg, nickmode); } else { printformat_module("fe-common/core", server_rec, target, msg_level, hilight ? TXT_PUBMSG_ME : TXT_PUBMSG, nick, msg, nickmode); } } g_free_not_null(nickmode); }
static void sig_message_public(SERVER_REC *server, const char *msg, const char *nick, const char *address, const char *target, NICK_REC *nickrec) { CHANNEL_REC *chanrec; const char *nickmode, *printnick; int for_me, print_channel, level; char *color, *freemsg = NULL; /* NOTE: this may return NULL if some channel is just closed with /WINDOW CLOSE and server still sends the few last messages */ chanrec = channel_find(server, target); if (nickrec == NULL && chanrec != NULL) nickrec = nicklist_find(chanrec, nick); for_me = nick_match_msg(chanrec, msg, server->nick); color = for_me ? NULL : hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg); print_channel = chanrec == NULL || !window_item_is_active((WI_ITEM_REC *) chanrec); if (!print_channel && settings_get_bool("print_active_channel") && window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL) print_channel = TRUE; level = MSGLEVEL_PUBLIC; if (for_me || color != NULL) level |= MSGLEVEL_HILIGHT; if (settings_get_bool("emphasis")) msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg); /* get nick mode & nick what to print the msg with (in case there's multiple identical nicks) */ nickmode = channel_get_nickmode_rec(nickrec); printnick = nickrec == NULL ? nick : g_hash_table_lookup(printnicks, nickrec); if (printnick == NULL) printnick = nick; if (!print_channel) { /* message to active channel in window */ if (color != NULL) { /* highlighted nick */ printformat(server, target, level, TXT_PUBMSG_HILIGHT, color, printnick, msg, nickmode); } else { printformat(server, target, level, for_me ? TXT_PUBMSG_ME : TXT_PUBMSG, printnick, msg, nickmode); } } else { /* message to not existing/active channel */ if (color != NULL) { /* highlighted nick */ printformat(server, target, level, TXT_PUBMSG_HILIGHT_CHANNEL, color, printnick, target, msg, nickmode); } else { printformat(server, target, level, for_me ? TXT_PUBMSG_ME_CHANNEL : TXT_PUBMSG_CHANNEL, printnick, target, msg, nickmode); } } g_free_not_null(freemsg); g_free_not_null(color); }