License update
[srvx.git] / src / hash.c
index bd205afa7d969c1a13a8a1073b33f17107f6d3eb..f5a21cddb661ef16a982bf0fe4e2c955432bd28e 100644 (file)
@@ -1,11 +1,12 @@
 /* hash.c - IRC network state database
  * Copyright 2000-2004 srvx Development Team
  *
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of srvx.
+ *
+ * srvx is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.  Important limitations are
- * listed in the COPYING file that accompanies this software.
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -13,7 +14,8 @@
  * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, email srvx-maintainers@srvx.net.
+ * along with srvx; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
  */
 
 #include "conf.h"
@@ -139,7 +141,7 @@ ReintroduceUser(struct userNode *user)
     unsigned int n;
        
     irc_user(user);
-    change.modes_set = change.modes_clear = 0;
+    mod_chanmode_init(&change);
     change.argc = 1;
     for (n = 0; n < user->channels.used; n++) {
         struct modeNode *mn = user->channels.list[n];
@@ -302,14 +304,14 @@ wipeout_channel(struct chanNode *cNode, time_t new_time, char **modes, unsigned
     /* deop anybody in the channel now, but count services to reop */
     for (nn=argc=0; nn<cNode->members.used; nn++) {
         struct modeNode *mn = cNode->members.list[nn];
-        if (mn->modes & MODE_CHANOP && IsService(mn->user) && IsLocal(mn->user))
+        if ((mn->modes & MODE_CHANOP) && IsService(mn->user) && IsLocal(mn->user))
             argc++;
     }
     if (argc) {
         extern struct userNode *opserv;
         struct mod_chanmode *change;
 
-        change = mod_chanmode_alloc(nn);
+        change = mod_chanmode_alloc(argc);
         change->modes_clear = 0;
         change->modes_set = orig_modes;
         change->new_limit = orig_limit;
@@ -322,6 +324,7 @@ wipeout_channel(struct chanNode *cNode, time_t new_time, char **modes, unsigned
                 argc++;
             }
         }
+        assert(argc == change->argc);
         if (change->argc > 0)
             mod_chanmode_announce(change->args[0].member->user, cNode, change);
         else
@@ -465,6 +468,9 @@ AddChannelUser(struct userNode *user, struct chanNode* channel)
        modeList_append(&channel->members, mNode);
        modeList_append(&user->channels, mNode);
 
+        if (channel->members.used == 1)
+            mNode->modes |= MODE_CHANOP;
+
         for (n=0; n<jf_used; n++) {
             /* Callbacks return true if they kick or kill the user,
              * and we can continue without removing mNode. */