]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/hash.c
more python work. Not safe to run yet
[irc/evilnet/x3.git] / src / hash.c
index 3f1b0f9a8573cc9ef8fea7de0665f536d72edb75..e0ce1f908bcb812375a8e86602291ea586359275 100644 (file)
@@ -197,6 +197,40 @@ NickChange(struct userNode* user, const char *new_nick, int no_announce)
     free(old_nick);
 }
 
+void
+SVSNickChange(struct userNode* user, const char *new_nick)
+{
+    char *old_nick;
+    unsigned int nn;
+
+    /* don't do anything if there's no change */
+    old_nick = user->nick;
+    if (!strncmp(new_nick, old_nick, NICKLEN))
+        return;
+
+    /* remove old entry from clients dictionary */
+    dict_remove(clients, old_nick);
+#if !defined(WITH_PROTOCOL_P10)
+    /* Remove from uplink's clients dict */
+    dict_remove(user->uplink->users, old_nick);
+#endif
+    /* and reinsert */
+    user->nick = strdup(new_nick);
+    dict_insert(clients, user->nick, user);
+#if !defined(WITH_PROTOCOL_P10)
+    dict_insert(user->uplink->users, user->nick, user);
+#endif
+
+    /* Make callbacks for nick changes.  Do this with new nick in
+     * place because that is slightly more useful.
+     */
+    for (nn=0; nn<ncf2_used; nn++)
+        ncf2_list[nn](user, old_nick);
+    user->timestamp = now;
+
+    free(old_nick);
+}
+
 struct userNode *
 GetUserH(const char *nick)
 {
@@ -522,7 +556,7 @@ DelChannel(struct chanNode *channel)
 
     /* go through all channel members and delete them from the channel */
     for (n=channel->members.used; n>0; )
-        DelChannelUser(channel->members.list[--n]->user, channel, NULL, 1);
+       DelChannelUser(channel->members.list[--n]->user, channel, false, 1);
 
     /* delete all channel bans */
     for (n=channel->banlist.used; n>0; )
@@ -638,7 +672,7 @@ DelChannelUser(struct userNode* user, struct chanNode* channel, const char *reas
     struct modeNode* mNode;
     unsigned int n;
 
-    if (IsLocal(user) && reason)
+    if (reason)
         irc_part(user, channel, reason);
 
     mNode = GetUserMode(channel, user);