소스 검색

* Added dovoice() for checking for y|y
* Changed order of init_modules() in main.c
-Fixed expire_Auths
-Fixed modules.c reporting wrong expmem


svn: 225

Bryan Drewery 22 년 전
부모
커밋
e36142aa5d
10개의 변경된 파일44개의 추가작업 그리고 27개의 파일을 삭제
  1. 1 0
      src/auth.c
  2. 2 1
      src/cmds.c
  3. 3 3
      src/main.c
  4. 14 0
      src/misc.c
  5. 16 16
      src/mod/irc.mod/irc.c
  6. 4 4
      src/mod/irc.mod/mode.c
  7. 1 1
      src/mod/module.h
  8. 1 1
      src/modules.c
  9. 1 0
      src/proto.h
  10. 1 1
      src/userrec.c

+ 1 - 0
src/auth.c

@@ -140,6 +140,7 @@ Context;
 void removeauth(int n)
 {
 Context;
+  putlog(LOG_DEBUG, "*", "Removing %s from auth list.", auth[n].host);
   auth_total--;
   if (n < auth_total)
     egg_memcpy(&auth[n], &auth[auth_total], sizeof(struct auth_t));

+ 2 - 1
src/cmds.c

@@ -2898,8 +2898,9 @@ static void cmd_newleaf(struct userrec *u, int idx, char *par)
       u1 = get_user_by_handle(userlist, handle);
       bi = user_malloc(sizeof(struct bot_addr));
 
-      bi->uplink = user_malloc(strlen(botnetnick) + 1);
+/*      bi->uplink = user_malloc(strlen(botnetnick) + 1); 
       strcpy(bi->uplink, botnetnick);
+*/
       bi->address = user_malloc(1);
       bi->address[0] = 0;
       bi->telnet_port = 3333;

+ 3 - 3
src/main.c

@@ -1437,18 +1437,18 @@ int main(int argc, char **argv)
   /* just load everything now, won't matter if it's loaded if the bot has to suicide on startup */
   init_settings();
   egg_snprintf(enetpass, sizeof enetpass, netpass);
-  init_auth();
-  init_config();
   init_dcc_max();
   init_userent();
   init_misc();
   init_bots();
   init_net();
   init_modules();
+  init_tcl(argc, argv);
+  init_auth();
+  init_config();
   init_userrec();
   if (backgrd)
     bg_prepare_split();
-  init_tcl(argc, argv);
   init_botcmd();
   link_statics();
   module_load(ENCMOD);

+ 14 - 0
src/misc.c

@@ -789,6 +789,20 @@ int ischanhub()
     return 0;
 }
 
+int dovoice(struct chanset_t *chan)
+{
+  struct userrec *user = NULL;
+  struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0 };
+
+  if (!chan) return 0;
+
+  user = get_user_by_handle(userlist, botnetnick);
+  get_user_flagrec(user, &fr, chan->dname);
+  if (glob_dovoice(fr) || chan_dovoice(fr))
+    return 1;
+  return 0;
+}
+
 #ifdef S_LASTCHECK
 char last_buf[128]="";
 #endif /* S_LASTCHECK */

+ 16 - 16
src/mod/irc.mod/irc.c

@@ -1110,9 +1110,7 @@ static void check_expired_chanstuff()
   memberlist *m, *n;
   char s[UHOSTLEN];
   struct chanset_t *chan;
-  struct userrec *buser = NULL;
   struct flag_record fr = {FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0};
-  struct flag_record fr3 = { FR_GLOBAL | FR_CHAN, 0, 0 };
 
   if (!server_online)
     return;
@@ -1206,30 +1204,32 @@ static void check_expired_chanstuff()
 	m = n;
       }
      //autovoice of +v users if bot is +y
-      buser = get_user_by_handle(userlist, botnetnick);
-      get_user_flagrec(buser, &fr3, chan->dname);
-
-      if (!loading && channel_active(chan) && me_op(chan) && (buser) && 
-      (chan_dovoice(fr3) || glob_dovoice(fr3))) {
+      if (!loading && channel_active(chan) && me_op(chan) && dovoice(chan)) {
         for (m = chan->channel.member; m && m->nick[0]; m = m->next) {
+          if (!m->user)
+            m->user = get_user_by_host(s);
+
           if (m->user) {
             struct flag_record fr2 = { FR_GLOBAL | FR_CHAN, 0, 0 };
-
             get_user_flagrec(m->user, &fr2, chan->dname);
-            if ((!channel_private(chan) || (channel_private(chan) && (glob_owner(fr2) || chan_voice(fr2)))) &&
-               ((!glob_bot(fr2) && ((chan_voice(fr2) || (glob_voice(fr2) && !chan_quiet(fr2))) ||
-               (channel_voice(chan) && (!chan_quiet(fr2) && !glob_quiet(fr2)))) &&
-               !chan_hasop(m) && !chan_hasvoice(m) && !(m->flags & EVOICE)))) {
+            if (!private(fr2, chan, PRIV_VOICE) && 
+               ((channel_voice(chan) && !chk_devoice(fr2, chan)) ||
+                (!channel_voice(chan) && chk_voice(fr2, chan))) &&      
+               !glob_bot(fr2) &&
+               !chan_hasop(m) && !chan_hasvoice(m) && !(m->flags & EVOICE)) {
               add_mode(chan, '+', 'v', m->nick);
             } else if (!glob_bot(fr2) && 
-              ((chan_quiet(fr2) || (glob_quiet(fr2) && !chan_voice(fr2))) || 
-              (m->flags & EVOICE))) {
+              (chk_devoice(fr2, chan) || (m->flags & EVOICE))) {
               if (!chan_hasop(m) && chan_hasvoice(m))
                 add_mode(chan, '-', 'v', m->nick);
             }
-          } else if (m->user == NULL && !(m->flags & EVOICE))
-             if (channel_voice(chan) && !chan_hasop(m) && !chan_hasvoice(m))
+          } else if (m->user == NULL && !(m->flags & EVOICE)) {
+             if (channel_voice(chan) && !chan_hasop(m) && !chan_hasvoice(m)) {
+/* FIXME: remove next line after testing for +v of +q user bug on -host */
+               putlog(LOG_DEBUG, "@", "VOICING %s in %s as NULL user (+voice)", m->nick, chan->dname);
                add_mode(chan, '+', 'v', m->nick);
+             }
+          }
         }
       }
       check_lonely_channel(chan);

+ 4 - 4
src/mod/irc.mod/mode.c

@@ -1141,8 +1141,8 @@ Context;
  	      m->flags &= ~SENTVOICE;
  	      m->flags |= CHANVOICE;
  	      check_tcl_mode(nick, from, u, chan->dname, ms2, op);
-              if ((channel_active(chan)) && (chan_dovoice(my_fr) || glob_dovoice(my_fr))) {
-                if (dv || (chan_quiet(victim) || (glob_quiet(victim) && !chan_voice(victim)))) {
+              if (channel_active(chan) && dovoice(chan)) {
+                if (dv || chk_devoice(victim, chan)) {
 		  add_mode(chan, '-', 'v', op);
 		} else if (reversing) {
 		  add_mode(chan, '-', 'v', op);
@@ -1152,9 +1152,9 @@ Context;
 	      m->flags &= ~SENTDEVOICE;
 	      m->flags &= ~CHANVOICE;
 	      check_tcl_mode(nick, from, u, chan->dname, ms2, op);
-              if ((channel_active(chan)) && (chan_dovoice(my_fr) || glob_dovoice(my_fr))) {
+              if (channel_active(chan) && dovoice(chan)) {
                 /* revoice +v users */
-                if ((chan_voice(victim) || (glob_voice(victim) && !chan_quiet(victim)))) {
+                if (chk_voice(victim, chan)) {
                   add_mode(chan, '+', 'v', op);
 		} else if (reversing) {
 		  add_mode(chan, '+', 'v', op);

+ 1 - 1
src/mod/module.h

@@ -253,7 +253,7 @@
 #define ver ((char *)global[119])
 /* 120 - 123 */
 #define notify_new ((char *)global[120])
-/* 121 helpdir -- UNUSED */
+#define dovoice ((int (*)(struct chanset_t *))global[121])
 #define Version ((char *)global[122])
 #define botnetnick ((char *)global[123])
 /* 124 - 127 */

+ 1 - 1
src/modules.c

@@ -309,7 +309,7 @@ Function global_table[] =
   (Function) ver,		 /* char *				*/
   /* 120 - 123 */
   (Function) notify_new,	 /* char *				*/
-  (Function) 0,		 /* char *				*/
+  (Function) dovoice,
   (Function) version,		 /* char *				*/
   (Function) botnetnick,	 /* char *				*/
   /* 124 - 127 */

+ 1 - 0
src/proto.h

@@ -255,6 +255,7 @@ int egg_strcatn(char *dst, const char *src, size_t max);
 int my_strcpy(char *, char *);
 void putlog EGG_VARARGS(int, arg1);
 int ischanhub();
+int dovoice(struct chanset_t *);
 void maskhost(const char *, char *);
 char *stristr(char *, char *);
 void splitc(char *, char *, char);

+ 1 - 1
src/userrec.c

@@ -17,7 +17,7 @@ extern struct dcc_t	*dcc;
 extern struct chanset_t	*chanset;
 extern int		 default_flags, default_uflags, quiet_save,
 			 dcc_total, share_greet;
-extern char		 userfile[], ver[], botnetnick[];
+extern char		 userfile[], ver[], botnetnick[], tempdir[];
 extern time_t		 now;
 
 int		 noshare = 1;		/* don't send out to sharebots	    */