瀏覽代碼

* Fixed a problem with conf.bot->u
We now clear it correctly with share.mod/clear_userlist()
And then re-init it in readuserfile()


svn: 686

Bryan Drewery 22 年之前
父節點
當前提交
db3b0a0b44
共有 5 個文件被更改,包括 20 次插入6 次删除
  1. 1 1
      src/log.c
  2. 5 2
      src/main.c
  3. 6 1
      src/mod/share.mod/share.c
  4. 3 0
      src/userrec.c
  5. 5 2
      src/users.c

+ 1 - 1
src/log.c

@@ -265,7 +265,7 @@ void putlog(int type, char *chname, char *format, ...)
   /* FIXME: WRITE LOG HERE */
 
   /* broadcast to hubs */
-  if (chname[0] == '*') {
+  if (chname[0] == '*' && conf.bot && conf.bot->nick) {
     char outbuf[LOGLINEMAX] = "";
 
     egg_snprintf(outbuf, sizeof outbuf, "hl %d %s", type, out);

+ 5 - 2
src/main.c

@@ -658,6 +658,7 @@ int main(int argc, char **argv)
   fillconf(&conf);
   free_conf();
 printf("I AM : %s (%d)\n", conf.bot->nick, conf.bot->pid);
+
   if ((localhub && !updating) || !localhub) {
     if ((conf.bot->pid > 0) && conf.bot->pid_file) {
       sdprintf(STR("%s is already running, pid: %d"), conf.bot->nick, conf.bot->pid);
@@ -665,7 +666,10 @@ printf("I AM : %s (%d)\n", conf.bot->nick, conf.bot->pid);
     }
   }
 
-fatal("WOOT", 0);
+  chanprog();
+printf("MY HANDLE: %s\n", conf.bot->u->handle);
+//fatal("WOOT", 0);
+
   dns_init();
   module_load("channels");
 #ifdef LEAF
@@ -680,7 +684,6 @@ fatal("WOOT", 0);
   ctcp_init();
   module_load("compress");
 
-  chanprog();
 
 #ifdef LEAF
   if (localhub) {

+ 6 - 1
src/mod/share.mod/share.c

@@ -1775,6 +1775,8 @@ static void finish_share(int idx)
   else
     for (i = 0; i < dcc_total; i++)
       dcc[i].user = get_user_by_handle(u, dcc[i].nick);
+  
+  conf.bot->u = NULL;
 
   /* Read the transferred userfile. Add entries to u, which already holds
    * the bot entries in non-override mode.
@@ -1785,7 +1787,7 @@ Context;
   if (!readuserfile(dcc[idx].u.xfer->filename, &u)) {
     char xx[1024];
 Context;
-    unlink(dcc[idx].u.xfer->filename); //why the fuck was this not here, stupid eggdev team.
+    unlink(dcc[idx].u.xfer->filename); /* why the fuck was this not here, stupid eggdev team. */
     loading = 0;
     putlog(LOG_MISC, "*", "%s", USERF_CANTREAD);
     clear_userlist(u);		/* Clear new, obsolete, user list.	*/
@@ -1793,6 +1795,9 @@ Context;
 				   channel lists.			*/
     for (i = 0; i < dcc_total; i++)
       dcc[i].user = get_user_by_handle(ou, dcc[i].nick);
+    
+    conf.bot->u = get_user_by_handle(ou, conf.bot->nick);
+
     userlist = ou;		/* Revert to old user list.		*/
     lastuser = NULL;		/* Reset last accessed user ptr.	*/
     checkchans(2); 		/* un-flag the channels, we are keeping them.. */

+ 3 - 0
src/userrec.c

@@ -175,6 +175,9 @@ void clear_userlist(struct userrec *bu)
 
     for (i = 0; i < dcc_total; i++)
       dcc[i].user = NULL;
+
+    conf.bot->u = NULL;
+
     clear_chanlist();
     lastuser = NULL;
 

+ 5 - 2
src/users.c

@@ -1002,13 +1002,16 @@ int readuserfile(char *file, struct userrec **ret)
 		putlog(LOG_MISC, "*", "* %s '%s'", USERF_BROKEPASS, code);
 		strcpy(pass, "-");
 	      }
-	      bu = adduser(bu, code, 0, pass,
-			   sanity_check(fr.global &USER_VALID));
+	      bu = adduser(bu, code, 0, pass, sanity_check(fr.global &USER_VALID));
 
 	      u = get_user_by_handle(bu, code);
 	      for (i = 0; i < dcc_total; i++)
 		if (!egg_strcasecmp(code, dcc[i].nick))
 		  dcc[i].user = u;
+        
+              if (!egg_strcasecmp(code, conf.bot->nick))
+                conf.bot->u = u;
+
 	      u->flags_udef = fr.udef_global;
 	      /* if s starts with '/' it's got file info */
 	    }