Explorar o código

* Fixed some hub compile issues regarding sharing buildts

svn: 408
Bryan Drewery %!s(int64=22) %!d(string=hai) anos
pai
achega
5163c7d433
Modificáronse 5 ficheiros con 18 adicións e 11 borrados
  1. 8 0
      src/botcmd.c
  2. 3 1
      src/dcc.c
  3. 1 0
      src/eggdrop.h
  4. 1 1
      src/mod/module.h
  5. 5 9
      src/mod/update.mod/update.c

+ 8 - 0
src/botcmd.c

@@ -863,6 +863,13 @@ static void bot_traced(int idx, char *par)
       botnet_send_traced(i, to, par);
   }
 }
+
+void bot_buildts(int idx, char *par)
+{
+  if (par && par[0])
+    dcc[idx].u.bot->bts = atoi(par);
+}
+
 void bot_timesync(int idx, char *par)
 {
   putlog(LOG_DEBUG, "@", "Got timesync from %s: %s\n", dcc[idx].nick, par);
@@ -1341,6 +1348,7 @@ botcmd_t C_bot[] =
   {"t",			(Function) bot_trace},
   {"tb",		(Function) bot_thisbot},
   {"td",		(Function) bot_traced},
+  {"bts",		(Function) bot_buildts},
   {"ts", 		(Function) bot_timesync},
   {"u",			(Function) bot_update},
   {"ul",		(Function) bot_unlink},

+ 3 - 1
src/dcc.c

@@ -25,7 +25,7 @@
 extern struct userrec	*userlist;
 extern struct chanset_t	*chanset;
 extern Tcl_Interp	*interp;
-extern time_t		 now;
+extern time_t		 now, buildts;
 extern int		 egg_numver, connect_timeout, conmask, backgrd,
 			 max_dcc, default_flags, debug_output,
 			 ignore_time;
@@ -224,6 +224,7 @@ static void greet_new_bot(int idx)
 
   dcc[idx].timeval = now;
   dcc[idx].u.bot->version[0] = 0;
+  dcc[idx].u.bot->bts = 0;
   dcc[idx].u.bot->sysname[0] = 0;
   dcc[idx].u.bot->numver = 0;
 #ifdef HUB
@@ -249,6 +250,7 @@ static void greet_new_bot(int idx)
 
   dprintf(idx, "v %d %d %s <%s>\n", egg_numver, HANDLEN, ver, network);
   dprintf(idx, "vs %s\n", sysname);
+  dprintf(idx, "bts %lu\n", buildts);
   for (i = 0; i < dcc_total; i++)
     if (dcc[i].type == &DCC_FORK_BOT) {
       killsock(dcc[i].sock);

+ 1 - 0
src/eggdrop.h

@@ -431,6 +431,7 @@ enum {
 
 struct bot_info {
   char version[121];		/* channel/version info			*/
+  time_t bts;			/* build timestamp */
   char linker[NOTENAMELEN + 1];	/* who requested this link		*/
   int  numver;
   char sysname[121];

+ 1 - 1
src/mod/module.h

@@ -359,7 +359,7 @@
 #define stripmasktype ((const char *(*)(int))global[203])
 /* 204 - 207 */
 #define online_since (*(int *)(global[204]))
-#define buildts (*(const int *)(global[205]))
+#define buildts (*(const time_t*)(global[205]))
 /* 206 -- UNUSED */
 #define check_dcc_attrs ((int (*)(struct userrec *,int))global[207])
 /* 208 - 211 */

+ 5 - 9
src/mod/update.mod/update.c

@@ -133,11 +133,8 @@ return;
 #ifdef HUB
   if (bupdating) return;
 
-  dcc[idx].status &= ~(STAT_GETTINGU | STAT_SENDINGU |
-                       STAT_OFFEREDU);
-
-  if ((dcc[idx].u.bot->buildts < buildts)
-      && (isupdatehub())) {
+  dcc[idx].status &= ~(STAT_GETTINGU | STAT_SENDINGU | STAT_OFFEREDU);
+  if ((dcc[idx].u.bot->bts < buildts) && (isupdatehub())) {
     dprintf(idx, "sb u?\n");
     dcc[idx].status |= STAT_OFFEREDU;
   }
@@ -196,7 +193,7 @@ static void got_nu(char *botnick, char *code, char *par)
      usleep(1000 * 500);
      botlink("", -3, botnick);
 #else
-     putlog(LOG_MISC, "*", "I need to be updated with %d", newver);
+     putlog(LOG_MISC, "*", "I need to be updated with %lu", newts);
 #endif /* LEAF */
    }  
 }
@@ -425,8 +422,7 @@ static void check_updates()
       dcc[i].status &= ~(STAT_GETTINGU | STAT_SENDINGU |
                        STAT_OFFEREDU);
 
-      if ((dcc[i].u.bot->buildts < buildts)
-        && (isupdatehub())) {
+      if ((dcc[i].u.bot->bts < buildts) && (isupdatehub())) {
         dprintf(i, "sb u?\n");
         dcc[i].status |= STAT_OFFEREDU;
       }
@@ -434,7 +430,7 @@ static void check_updates()
   }
 
   //send out notice to update remote bots ...
-  sprintf(buf, "nu? %d", buildts);
+  sprintf(buf, "nu? %lu", buildts);
   putallbots(buf);
 }
 #endif