]> jfr.im git - irc/freenode/solanum.git/commitdiff
/accept list should track nick changes when you share channels (#96)
authorjess <redacted>
Mon, 25 Jan 2021 05:00:34 +0000 (05:00 +0000)
committerGitHub <redacted>
Mon, 25 Jan 2021 05:00:34 +0000 (21:00 -0800)
* move has_common_channel to s_user.c

* don't remove clients from /accept on NICK when there's a common channel

Co-authored-by: Ed Kellett <redacted>
include/s_user.h
ircd/s_user.c
modules/core/m_nick.c
modules/um_callerid.c

index e0f41aa30cfc53c0d0aeb4d4edc510118685ed8d..9fb6f7edd7195e336d1aeb85af30cd6a6086756a 100644 (file)
@@ -54,3 +54,5 @@ extern void construct_umodebuf(void);
 extern void oper_up(struct Client *, struct oper_conf *);
 
 #endif
+
+extern bool has_common_channel(struct Client *source_p, struct Client *target_p);
index 0fa78ba47e2d7ad5cec9b0e18cf4567f84a845c9..7ea20e7ff81b996604741b6717e65203abc9780e 100644 (file)
@@ -1644,3 +1644,20 @@ change_nick_user_host(struct Client *target_p,   const char *nick, const char *use
                del_all_accepts(target_p);
        }
 }
+
+bool
+has_common_channel(struct Client *source_p, struct Client *target_p)
+{
+        rb_dlink_node *ps, *pt;
+        struct membership *ms, *mt;
+        struct Channel *chptr;
+
+        ITER_COMM_CHANNELS(ps, pt, source_p->user->channel.head, target_p->user->channel.head, ms, mt, chptr)
+        {
+                if (ms != NULL && mt != NULL)
+                        return true;
+        }
+
+        return false;
+}
+
index a5b94d59161657c7e4f429c5b92d4a5f724ed160..890d0c2b3059928ae18571f389a9fb5d89400a8d 100644 (file)
@@ -712,8 +712,11 @@ change_local_nick(struct Client *client_p, struct Client *source_p,
        {
                target_p = ptr->data;
 
-               rb_dlinkFindDestroy(source_p, &target_p->localClient->allow_list);
-               rb_dlinkDestroy(ptr, &source_p->on_allow_list);
+               if (!has_common_channel(source_p, target_p))
+               {
+                       rb_dlinkFindDestroy(source_p, &target_p->localClient->allow_list);
+                       rb_dlinkDestroy(ptr, &source_p->on_allow_list);
+               }
        }
 
        snprintf(note, sizeof(note), "Nick: %s", nick);
@@ -729,6 +732,8 @@ static void
 change_remote_nick(struct Client *client_p, struct Client *source_p,
                   time_t newts, const char *nick, int dosend)
 {
+       struct Client *target_p;
+       rb_dlink_node *ptr, *next_ptr;
        struct nd_entry *nd;
        int samenick = irccmp(source_p->name, nick) ? 0 : 1;
        hook_cdata hook_info;
@@ -771,7 +776,16 @@ change_remote_nick(struct Client *client_p, struct Client *source_p,
                monitor_signon(source_p);
 
        /* remove all accepts pointing to the client */
-       del_all_accepts(source_p);
+       RB_DLINK_FOREACH_SAFE(ptr, next_ptr, source_p->on_allow_list.head)
+       {
+               target_p = ptr->data;
+
+               if (!has_common_channel(source_p, target_p))
+               {
+                       rb_dlinkFindDestroy(source_p, &target_p->localClient->allow_list);
+                       rb_dlinkDestroy(ptr, &source_p->on_allow_list);
+               }
+       }
 }
 
 static void
index 56394986a3ee80de0ed7531f04fbc09e7861403c..2fa47db4d064e1465f38dad9adf6635c17875414 100644 (file)
@@ -87,22 +87,6 @@ um_callerid_moddeinit(void)
 static const char um_callerid_desc[] =
        "Provides usermodes +g and +G which restrict messages from unauthorized users.";
 
-static bool
-has_common_channel(struct Client *source_p, struct Client *target_p)
-{
-       rb_dlink_node *ps, *pt;
-       struct membership *ms, *mt;
-       struct Channel *chptr;
-
-       ITER_COMM_CHANNELS(ps, pt, source_p->user->channel.head, target_p->user->channel.head, ms, mt, chptr)
-       {
-               if (ms != NULL && mt != NULL)
-                       return true;
-       }
-
-       return false;
-}
-
 static bool
 allow_message(struct Client *source_p, struct Client *target_p)
 {