Explorar el Código

* Massop after done deopping!

svn: 1013
Bryan Drewery hace 22 años
padre
commit
2e0208fd6c
Se han modificado 3 ficheros con 39 adiciones y 6 borrados
  1. 1 0
      doc/UPDATES
  2. 35 4
      src/mod/irc.mod/chan.c
  3. 3 2
      src/mod/irc.mod/mode.c

+ 1 - 0
doc/UPDATES

@@ -9,6 +9,7 @@ This is a summary of ChangeLog basically.
 5.No longer warning about "Can't create new socket" for identd.
 6.Re-wrote cmd_bots.
 7.Don't auto-op users in a +take chan.
+8.+take now does +oooo on remaining bots instead of individual +o lines.
 
 1.1.7
 

+ 35 - 4
src/mod/irc.mod/chan.c

@@ -1000,6 +1000,34 @@ void enforce_closed(struct chanset_t *chan) {
   priority_do(chan, 0, PRIO_KICK);
 }
 
+static char *
+take_massopline(char *to_op)
+{
+  char *op = NULL, *modes = NULL, *nicks = NULL, *ret = NULL;
+  int i = 0;
+
+  nicks = calloc(1, 51);
+  modes = calloc(1, 10);
+  
+  for (i = 0; i < 4; i++) {
+    if (to_op[0]) {
+      op = newsplit(&to_op);
+      strcat(modes, "+o");
+      strcat(nicks, op);
+      strcat(nicks, " "); 
+    }
+  }
+  
+  ret = calloc(1, 61);
+  strcat(ret, modes);
+  strcat(ret, " ");
+  strcat(ret, nicks);
+  free(modes);
+  free(nicks);
+  
+  return ret;
+}
+
 static char *
 take_makeline(char *op, char *deops, int deopn)
 {
@@ -1063,7 +1091,7 @@ do_take(struct chanset_t *chan)
   */
   while (to_op[0] || to_deop[0]) {
     int deopn = 0, i = 0;
-    char *op = NULL, *deopline = NULL, deops[201] = "";
+    char *op = NULL, *modeline = NULL, deops[201] = "";
 
     if (to_op[0])
       op = newsplit(&to_op);
@@ -1080,11 +1108,14 @@ do_take(struct chanset_t *chan)
     strcat(work, chan->name);
     strcat(work, " ");
 
-    deopline = take_makeline(op, deops, deopn);
-    strcat(work, deopline);
+    if (deops[0])
+      modeline = take_makeline(op, deops, deopn);
+    else
+      modeline = take_massopline(to_op);
+    strcat(work, modeline);
     strcat(work, "\n");
     lines++;
-    free(deopline);
+    free(modeline);
 
     /* just dump when we have 5 lines because the server is going to throttle after that anyway */
     if (lines == 5) {

+ 3 - 2
src/mod/irc.mod/mode.c

@@ -385,7 +385,8 @@ static void got_op(struct chanset_t *chan, char *nick, char *from,
     /* take asap. */
     if (channel_take(chan))
       do_take(chan);
-    check_chan = 1;
+    else
+      check_chan = 1;
   }
 
   if (!m->user) {
@@ -536,7 +537,7 @@ static void got_deop(struct chanset_t *chan, char *nick, char *from,
   /* Having op hides your +v and +h  status -- so now that someone's lost ops,
    * check to see if they have +v or +h
    */
-  if (!(m->flags & (CHANVOICE | STOPWHO))) {
+  if (!channel_take(chan) && !channel_bitch(chan) && !(m->flags & (CHANVOICE | STOPWHO))) {
     dprintf(DP_HELP, "WHO %s\n", m->nick);
     m->flags |= STOPWHO;
   }