]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Added ability to ignore joins, parts and quits of an ignored user. origin/ignore-joins-parts
authorArnavion <redacted>
Sat, 11 Jun 2016 22:46:32 +0000 (15:46 -0700)
committerArnavion <redacted>
Sat, 11 Jun 2016 22:46:32 +0000 (15:46 -0700)
Mentioned in #500

src/common/ignore.c
src/common/ignore.h
src/common/inbound.c
src/common/inbound.h
src/common/proto-irc.c
src/common/textevents.in
src/fe-gtk/ignoregui.c

index 639b99479e1a9323c20eca8007bc9ac5cc5002a7..daecf5eecaf775406544370a55a6dd3b3c0faecf 100644 (file)
@@ -151,6 +151,10 @@ ignore_showlist (session *sess)
                        strcat (tbuf, _("YES  "));
                else
                        strcat (tbuf, _("NO   "));
+               if (ig->type & IG_JOINS_PARTS)
+                       strcat (tbuf, _("YES         "));
+               else
+                       strcat (tbuf, _("NO          "));
                strcat (tbuf, "\n");
                PrintText (sess, tbuf);
                /*EMIT_SIGNAL (XP_TE_IGNORELIST, sess, ig->mask, 0, 0, 0, 0); */
index 5aefafe5bf45466822a2406d9b07fcfc3c2bdcc4..c60f2e3954add0289a5e25ddea81bf3e5ec1705d 100644 (file)
@@ -36,6 +36,7 @@ extern int ignored_invi;
 #define IG_UNIG        32
 #define IG_NOSAVE      64
 #define IG_DCC         128
+#define IG_JOINS_PARTS 256
 
 struct ignore
 {
index 0e962cafa9b8d269f5440aab4c1dc3f1e0a627b0..2ac9d12242d16f963cb21f68fa3146c40939cf0f 100644 (file)
@@ -770,14 +770,15 @@ inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
 }
 
 void
-inbound_join (server *serv, char *chan, char *user, char *ip, char *account,
+inbound_join (server *serv, char *chan, char *host, char *user, char *ip, char *account,
                                  char *realname, const message_tags_data *tags_data)
 {
        session *sess = find_channel (serv, chan);
        if (sess)
        {
-               EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
-                                                                         tags_data->timestamp);
+               if (!ignore_check(host, IG_JOINS_PARTS))
+                       EMIT_SIGNAL_TIMESTAMP (XP_TE_JOIN, sess, user, chan, ip, account, 0,
+                                              tags_data->timestamp);
                userlist_add (sess, user, ip, account, realname, tags_data);
        }
 }
@@ -796,18 +797,19 @@ inbound_kick (server *serv, char *chan, char *user, char *kicker, char *reason,
 }
 
 void
-inbound_part (server *serv, char *chan, char *user, char *ip, char *reason,
+inbound_part (server *serv, char *chan, char *host, char *user, char *ip, char *reason,
                                  const message_tags_data *tags_data)
 {
        session *sess = find_channel (serv, chan);
        if (sess)
        {
-               if (*reason)
-                       EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
-                                                                                 0, tags_data->timestamp);
-               else
-                       EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
-                                                                                 tags_data->timestamp);
+               if (!ignore_check(host, IG_JOINS_PARTS))
+                       if (*reason)
+                               EMIT_SIGNAL_TIMESTAMP (XP_TE_PARTREASON, sess, user, ip, chan, reason,
+                                                      0, tags_data->timestamp);
+                       else
+                               EMIT_SIGNAL_TIMESTAMP (XP_TE_PART, sess, user, ip, chan, NULL, 0,
+                                                      tags_data->timestamp);
                userlist_remove (sess, user);
        }
 }
@@ -828,7 +830,7 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
 }
 
 void
-inbound_quit (server *serv, char *nick, char *ip, char *reason,
+inbound_quit (server *serv, char *host, char *nick, char *ip, char *reason,
                                  const message_tags_data *tags_data)
 {
        GSList *list = sess_list;
@@ -845,8 +847,9 @@ inbound_quit (server *serv, char *nick, char *ip, char *reason,
                                was_on_front_session = TRUE;
                        if ((user = userlist_find (sess, nick)))
                        {
-                               EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
-                                                                                         tags_data->timestamp);
+                               if (!ignore_check(host, IG_JOINS_PARTS))
+                                       EMIT_SIGNAL_TIMESTAMP (XP_TE_QUIT, sess, nick, reason, ip, NULL, 0,
+                                                              tags_data->timestamp);
                                userlist_remove_user (sess, user);
                        } else if (sess->type == SESS_DIALOG && !serv->p_cmp (sess->channel, nick))
                        {
index 83e78d5d8924815a24364ebb3e88309118ed1f35..5fed394310ebb312eb8beb69e360c3891e5044c1 100644 (file)
@@ -28,7 +28,7 @@ void inbound_uback (server *serv, const message_tags_data *tags_data);
 void inbound_uaway (server *serv, const message_tags_data *tags_data);
 void inbound_account (server *serv, char *nick, char *account,
                                                         const message_tags_data *tags_data);
-void inbound_part (server *serv, char *chan, char *user, char *ip, char *reason,
+void inbound_part (server *serv, char *chan, char *host, char *user, char *ip, char *reason,
                                                 const message_tags_data *tags_data);
 void inbound_upart (server *serv, char *chan, char *ip, char *reason,
                                                  const message_tags_data *tags_data);
@@ -38,11 +38,11 @@ void inbound_kick (server *serv, char *chan, char *user, char *kicker,
                                                 char *reason, const message_tags_data *tags_data);
 void inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip,
                                                        int id, const message_tags_data *tags_data);
-void inbound_quit (server *serv, char *nick, char *ip, char *reason,
+void inbound_quit (server *serv, char *host, char *nick, char *ip, char *reason,
                                                 const message_tags_data *tags_data);
 void inbound_topicnew (server *serv, char *nick, char *chan, char *topic,
                                                          const message_tags_data *tags_data);
-void inbound_join (server *serv, char *chan, char *user, char *ip, 
+void inbound_join (server *serv, char *chan, char *host, char *user, char *ip,
                                                 char *account, char *realname, 
                                                 const message_tags_data *tags_data);
 void inbound_ujoin (server *serv, char *chan, char *nick, char *ip,
index 8e0d0ec14c8c5477e2c774362d9504206a98055c..f9e3d214c9b49a838aec5cf55ce90291aab9ca43 100644 (file)
@@ -1046,8 +1046,8 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
                                if (!serv->p_cmp (nick, serv->nick))
                                        inbound_ujoin (serv, chan, nick, ip, tags_data);
                                else
-                                       inbound_join (serv, chan, nick, ip, account, realname,
-                                                                         tags_data);
+                                       inbound_join (serv, chan, word[1], nick, ip, account, realname,
+                                                     tags_data);
                        }
                        return;
 
@@ -1100,7 +1100,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
                                if (!strcmp (nick, serv->nick))
                                        inbound_upart (serv, chan, ip, reason, tags_data);
                                else
-                                       inbound_part (serv, chan, nick, ip, reason, tags_data);
+                                       inbound_part (serv, chan, word[1], nick, ip, reason, tags_data);
                        }
                        return;
 
@@ -1115,9 +1115,9 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
                        return;
 
                case WORDL('Q','U','I','T'):
-                       inbound_quit (serv, nick, ip,
-                                                         (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
-                                                         tags_data);
+                       inbound_quit (serv, word[1], nick, ip,
+                                     (word_eol[3][0] == ':') ? word_eol[3] + 1 : word_eol[3],
+                                     tags_data);
                        return;
 
                case WORDL('A','W','A','Y'):
index e4405ca343161a547b614e3d1cddcd8b81f691ab..634bd4c7a3fecdfdc6a16e1e18f70ed9870901e6 100644 (file)
@@ -469,7 +469,7 @@ pevt_generic_none_help
 Ignore Header
 XP_TE_IGNOREHEADER
 pevt_generic_none_help
-%C16,17 Hostmask                  PRIV NOTI CHAN CTCP DCC  INVI UNIG 
+%C16,17 Hostmask                  PRIV NOTI CHAN CTCP DCC  INVI UNIG JOINS_PARTS
 0
 
 Ignore Remove
index f0ae8b284a9a2e7226c0516b3f176f1af77f0746..8daf25e9b2e06af631a715eb1aabfe7f7067f402 100644 (file)
@@ -40,6 +40,7 @@ enum
        CTCP_COLUMN,
        DCC_COLUMN,
        INVITE_COLUMN,
+       JOINS_PARTS_COLUMN,
        UNIGNORE_COLUMN,
        N_COLUMNS
 };
@@ -61,7 +62,7 @@ get_store (void)
 static unsigned int
 ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
 {
-       gboolean chan, priv, noti, ctcp, dcc, invi, unig;
+       gboolean chan, priv, noti, ctcp, dcc, invi, joins_parts, unig;
        unsigned int flags = 0;
 
        gtk_tree_model_get (
@@ -72,6 +73,7 @@ ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
                CTCP_COLUMN, &ctcp,
                DCC_COLUMN, &dcc,
                INVITE_COLUMN, &invi,
+               JOINS_PARTS_COLUMN, &joins_parts,
                UNIGNORE_COLUMN, &unig,
                -1);
        if (chan)
@@ -86,6 +88,8 @@ ignore_get_flags (GtkTreeModel *model, GtkTreeIter *iter)
                flags |= IG_DCC;
        if (invi)
                flags |= IG_INVI;
+       if (joins_parts)
+               flags |= IG_JOINS_PARTS;
        if (unig)
                flags |= IG_UNIG;
        return flags;
@@ -169,6 +173,7 @@ ignore_treeview_new (GtkWidget *box)
                                     CTCP_COLUMN, _("CTCP"),
                                     DCC_COLUMN, _("DCC"),
                                     INVITE_COLUMN, _("Invite"),
+                                    JOINS_PARTS_COLUMN, _("Joins & Parts"),
                                     UNIGNORE_COLUMN, _("Unignore"),
                                     -1);
 
@@ -240,7 +245,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
        GtkListStore *store = GTK_LIST_STORE (get_store ());
        GtkTreeIter iter;
        GtkTreePath *path;
-       unsigned int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI;
+       unsigned int flags = IG_CHAN | IG_PRIV | IG_NOTI | IG_CTCP | IG_DCC | IG_INVI | IG_JOINS_PARTS;
 
        if (cancel)
                return;
@@ -264,6 +269,7 @@ ignore_store_new (int cancel, char *mask, gpointer data)
                CTCP_COLUMN, TRUE,
                DCC_COLUMN, TRUE,
                INVITE_COLUMN, TRUE,
+               JOINS_PARTS_COLUMN, TRUE,
                UNIGNORE_COLUMN, FALSE,
                -1);
        /* make sure the new row is visible and selected */
@@ -354,7 +360,7 @@ ignore_gui_open ()
        GtkTreeIter iter;
        GSList *temp = ignore_list;
        char *mask;
-       gboolean private, chan, notice, ctcp, dcc, invite, unignore;
+       gboolean private, chan, notice, ctcp, dcc, invite, joins_parts, unignore;
 
        if (ignorewin)
        {
@@ -413,6 +419,7 @@ ignore_gui_open ()
                ctcp = (ignore->type & IG_CTCP);
                dcc = (ignore->type & IG_DCC);
                invite = (ignore->type & IG_INVI);
+               joins_parts = (ignore->type & IG_JOINS_PARTS);
                unignore = (ignore->type & IG_UNIG);
 
                gtk_list_store_append (store, &iter);
@@ -424,6 +431,7 @@ ignore_gui_open ()
                                    CTCP_COLUMN, ctcp,
                                    DCC_COLUMN, dcc,
                                    INVITE_COLUMN, invite,
+                                   JOINS_PARTS_COLUMN, joins_parts,
                                    UNIGNORE_COLUMN, unignore,
                                    -1);