comparison mcabber/src/hooks.c @ 1129:1a109ebf3f24

Add option "events_ignore_active_window"
author Mikael Berthe <mikael@lilotux.net>
date Sat, 20 Jan 2007 19:39:54 +0100
parents 14e458020e23
children 9726c78a91f3
comparison
equal deleted inserted replaced
1128:ac9c89f6cb51 1129:1a109ebf3f24
41 { 41 {
42 int new_guy = FALSE; 42 int new_guy = FALSE;
43 int is_groupchat = FALSE; // groupchat message 43 int is_groupchat = FALSE; // groupchat message
44 int is_room = FALSE; // window is a room window 44 int is_room = FALSE; // window is a room window
45 int log_muc_conf = FALSE; 45 int log_muc_conf = FALSE;
46 int active_window = FALSE;
46 int message_flags = 0; 47 int message_flags = 0;
47 guint rtype = ROSTER_TYPE_USER; 48 guint rtype = ROSTER_TYPE_USER;
48 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL; 49 char *wmsg = NULL, *bmsg = NULL, *mmsg = NULL;
49 GSList *roster_usr; 50 GSList *roster_usr;
50 51
134 // option is off (and it is not a history line) 135 // option is off (and it is not a history line)
135 if (!(message_flags & HBB_PREFIX_ERR) && 136 if (!(message_flags & HBB_PREFIX_ERR) &&
136 (!is_room || (is_groupchat && log_muc_conf && !timestamp))) 137 (!is_room || (is_groupchat && log_muc_conf && !timestamp)))
137 hlog_write_message(bjid, timestamp, FALSE, wmsg); 138 hlog_write_message(bjid, timestamp, FALSE, wmsg);
138 139
140 if (settings_opt_get_int("events_ignore_active_window") &&
141 current_buddy && scr_get_chatmode()) {
142 gpointer bud = BUDDATA(current_buddy);
143 if (bud) {
144 const char *cjid = buddy_getjid(bud);
145 if (cjid && !strcasecmp(cjid, bjid))
146 active_window = TRUE;
147 }
148 }
149
139 // External command 150 // External command
140 // - We do not call hk_ext_cmd() for history lines in MUC 151 // - We do not call hk_ext_cmd() for history lines in MUC
141 // - We do call hk_ext_cmd() for private messages in a room 152 // - We do call hk_ext_cmd() for private messages in a room
142 if ((is_groupchat && !timestamp) || !is_groupchat) 153 // - We do call hk_ext_cmd() for messages to the current window
154 if (!active_window && ((is_groupchat && !timestamp) || !is_groupchat))
143 hk_ext_cmd(bjid, (is_groupchat ? 'G' : 'M'), 'R', wmsg); 155 hk_ext_cmd(bjid, (is_groupchat ? 'G' : 'M'), 'R', wmsg);
144 156
145 // Display the sender in the log window 157 // Display the sender in the log window
146 if ((!is_groupchat) && !(message_flags & HBB_PREFIX_ERR) && 158 if ((!is_groupchat) && !(message_flags & HBB_PREFIX_ERR) &&
147 settings_opt_get_int("log_display_sender")) { 159 settings_opt_get_int("log_display_sender")) {