فهرست منبع

* C++ hub fixes

svn: 1318
Bryan Drewery 22 سال پیش
والد
کامیت
b78962cf18
7فایلهای تغییر یافته به همراه70 افزوده شده و 72 حذف شده
  1. 9 9
      src/botnet.c
  2. 18 18
      src/cmds.c
  3. 2 2
      src/mod/channels.mod/channels.c
  4. 1 1
      src/mod/console.mod/console.c
  5. 36 38
      src/mod/transfer.mod/transfer.c
  6. 1 1
      src/mod/update.mod/update.c
  7. 3 3
      src/userent.c

+ 9 - 9
src/botnet.c

@@ -575,7 +575,7 @@ void tell_bottree(int idx)
   char s[161] = "", work[1024] = "";
   tand_t *last[20] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                        NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
-  tand_t *this = NULL, *bot = NULL, *bot2 = NULL;
+  tand_t *thisbot = NULL, *bot = NULL, *bot2 = NULL;
   int lev = 0, more = 1, mark[20], ok, cnt, i = 0, imark, tothops = 0;
 
   if (tands == 0) {
@@ -600,7 +600,7 @@ void tell_bottree(int idx)
                                     localhub ? COLOR_END(idx) : "",
                                     egg_version, buildts);
 
-  this = (tand_t *) 1;
+  thisbot = (tand_t *) 1;
   work[0] = 0;
   while (more) {
     if (lev == 20) {
@@ -610,7 +610,7 @@ void tell_bottree(int idx)
     cnt = 0;
     tothops += lev;
     for (bot = tandbot; bot; bot = bot->next)
-      if (bot->uplink == this)
+      if (bot->uplink == thisbot)
 	cnt++;
     if (cnt) {
       imark = 0;
@@ -628,7 +628,7 @@ void tell_bottree(int idx)
       s[0] = 0;
       bot = tandbot;
       while (!s[0]) {
-	if (bot->uplink == this) {
+	if (bot->uplink == thisbot) {
           if (bot->share)
             i = sprintf(s, "%c", bot->share);
           else
@@ -646,8 +646,8 @@ void tell_bottree(int idx)
       else
 	mark[lev] = 0;
       work[0] = 0;
-      last[lev] = this;
-      this = bot;
+      last[lev] = thisbot;
+      thisbot = bot;
       lev++;
       more = 1;
     } else {
@@ -660,7 +660,7 @@ void tell_bottree(int idx)
 	ok = 0;
 	for (bot = tandbot; bot; bot = bot->next) {
 	  if (bot->uplink == last[lev - 1]) {
-	    if (this == bot)
+	    if (thisbot == bot)
 	      ok = 1;
 	    else if (ok) {
 	      cnt++;
@@ -692,7 +692,7 @@ void tell_bottree(int idx)
 	    dprintf(idx, "%s  |-%s\n", work, s);
 	  else
 	    dprintf(idx, "%s  `-%s\n", work, s);
-	  this = bot2;
+	  thisbot = bot2;
 	  work[0] = 0;
 	  if (cnt > 1)
 	    mark[lev - 1] = 1;
@@ -706,7 +706,7 @@ void tell_bottree(int idx)
 	    cnt = 999;
 	  } else {
 	    more = 1;
-	    this = last[lev];
+	    thisbot = last[lev];
 	  }
 	}
       }

+ 18 - 18
src/cmds.c

@@ -368,7 +368,7 @@ static void cmd_botconfig(int idx, char *par)
   if (!par[0]) {
     for (i = 0; i < cfg_count; i++) {
       if ((cfg[i]->flags & CFGF_LOCAL) && (cfg[i]->describe)) {
-	k = get_user(&USERENTRY_CONFIG, u2);
+	k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
 	while (k && strcmp(k->key, cfg[i]->name))
 	  k=k->next;
 	if (k)
@@ -402,7 +402,7 @@ static void cmd_botconfig(int idx, char *par)
     if (cfgent->describe)
       cfgent->describe(cfgent, idx);
   }
-  k = get_user(&USERENTRY_CONFIG, u2);
+  k = (struct xtra_key *) get_user(&USERENTRY_CONFIG, u2);
   while (k && strcmp(k->key, cfgent->name))
     k = k->next;
   if (k)
@@ -1422,7 +1422,7 @@ static void cmd_handle(int idx, char *par)
 #ifdef HUB
 static void cmd_chpass(int idx, char *par)
 {
-  char *handle = NULL, *new = NULL, pass[MAXPASSLEN] = "";
+  char *handle = NULL, *newpass = NULL, pass[MAXPASSLEN] = "";
   int atr = dcc[idx].user ? dcc[idx].user->flags : 0, l;
   struct userrec *u = NULL;
 
@@ -1449,15 +1449,15 @@ static void cmd_chpass(int idx, char *par)
       dprintf(idx, "Removed password.\n");
     } else {
       int good = 0;
-      l = strlen(new = newsplit(&par));
+      l = strlen(newpass = newsplit(&par));
       if (l > MAXPASSLEN)
-	new[MAXPASSLEN] = 0;
-      if (!strcmp(new, "rand")) {
+	newpass[MAXPASSLEN] = 0;
+      if (!strcmp(newpass, "rand")) {
         make_rand_str(pass, MAXPASSLEN);
         good = 1;
       } else {
-        if (goodpass(new, idx, NULL)) {
-          egg_snprintf(pass, sizeof pass, "%s", new);
+        if (goodpass(newpass, idx, NULL)) {
+          egg_snprintf(pass, sizeof pass, "%s", newpass);
           good = 1;
         }
       }
@@ -1478,7 +1478,7 @@ static void cmd_chpass(int idx, char *par)
 
 static void cmd_chsecpass(int idx, char *par)
 {
-  char *handle = NULL, *new = NULL, pass[MAXPASSLEN + 1] = "";
+  char *handle = NULL, *newpass = NULL, pass[MAXPASSLEN + 1] = "";
   int atr = dcc[idx].user ? dcc[idx].user->flags : 0, l;
   struct userrec *u = NULL;
 
@@ -1505,17 +1505,17 @@ static void cmd_chsecpass(int idx, char *par)
       dprintf(idx, "Removed secpass.\n");
     } else {
 
-      l = strlen(new = newsplit(&par));
+      l = strlen(newpass = newsplit(&par));
       if (l > MAXPASSLEN)
-	new[MAXPASSLEN] = 0;
-      if (!strcmp(new, "rand")) {
+	newpass[MAXPASSLEN] = 0;
+      if (!strcmp(newpass, "rand")) {
         make_rand_str(pass, MAXPASSLEN);
       } else {
-        if (strlen(new) < 6) {
+        if (strlen(newpass) < 6) {
           dprintf(idx, "Please use at least 6 characters.\n");
           return;
         } else {
-          egg_snprintf(pass, sizeof pass, "%s", new);
+          egg_snprintf(pass, sizeof pass, "%s", newpass);
         }
       }
       if (strlen(pass) > MAXPASSLEN)
@@ -1567,7 +1567,7 @@ static void cmd_botcmd(int idx, char *par)
       continue;
     cnt++;
     if ((rleaf != -1 && cnt == rleaf) || (rleaf == -1 && wild_match(botm, tbot->bot))) {
-      send_remote_simul(idx, tbot->bot, cmd, par ? par : "");
+      send_remote_simul(idx, tbot->bot, cmd, par ? par : (char *) "");
       found++;
     }
   }
@@ -1597,7 +1597,7 @@ static void cmd_hublevel(int idx, char *par)
     return;
   }
   dprintf(idx, "Changed bot's hublevel.\n");
-  obi = get_user(&USERENTRY_BOTADDR, u1);
+  obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
   bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(obi->uplink);
@@ -1635,8 +1635,8 @@ static void cmd_uplink(int idx, char *par)
     dprintf(idx, "Changed bot's uplink.\n");
   else
     dprintf(idx, "Cleared bot's uplink.\n");
-  obi = get_user(&USERENTRY_BOTADDR, u1);
-  bi = (struct bot_addry *) calloc(1, sizeof(struct bot_addr));
+  obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
+  bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
 
   bi->uplink = strdup(uplink);
   bi->address = strdup(obi->address);

+ 2 - 2
src/mod/channels.mod/channels.c

@@ -318,7 +318,7 @@ static void rebalance_roles()
 
   for (i = 0; i < (unsigned) dcc_total; i++) {
     if (dcc[i].user && dcc[i].user->bot && bot_hublevel(dcc[i].user) == 999) {
-      ba = get_user(&USERENTRY_BOTADDR, dcc[i].user);
+      ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, dcc[i].user);
       if (ba && (ba->roleid > 0) && (ba->roleid < 5))
         r[(ba->roleid - 1)]++;
     }
@@ -340,7 +340,7 @@ static void rebalance_roles()
   while (r[hNdx] - r[lNdx] >= 2) {
     for (i = 0; i < (unsigned) dcc_total; i++) {
       if (dcc[i].user && dcc[i].user->bot && bot_hublevel(dcc[i].user) == 999) {
-        ba = get_user(&USERENTRY_BOTADDR, dcc[i].user);
+        ba = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, dcc[i].user);
         if (ba && (ba->roleid == (hNdx + 1))) {
           ba->roleid = lNdx + 1;
           sprintf(tmp, "rl %d", lNdx + 1);

+ 1 - 1
src/mod/console.mod/console.c

@@ -88,7 +88,7 @@ console_kill(struct user_entry *e)
 static int
 console_write_userfile(FILE * f, struct userrec *u, struct user_entry *e)
 {
-  struct console_info *i = e->u.extra;
+  struct console_info *i = (struct console_info *) e->u.extra;
 
   if (lfprintf(f, "--CONSOLE %s %s %s %d %d %d %d %d %d %d %d\n",
                i->channel, masktype(i->conflags),

+ 36 - 38
src/mod/transfer.mod/transfer.c

@@ -49,8 +49,6 @@ static int quiet_reject = 1;        /* Quietly reject dcc chat or sends from
 static void wipe_tmp_filename(char *, int);
 static int at_limit(char *);
 static void dcc_get_pending(int, char *, int);
-struct dcc_table DCC_GET;
-struct dcc_table DCC_GET_PENDING;
 #endif /* HUB */
 
 static fileq_t *fileq = NULL;
@@ -104,11 +102,11 @@ static char *replace_spaces(char *fn)
 }
 
 
-static void deq_this(fileq_t *this)
+static void deq_this(fileq_t *thisfile)
 {
   fileq_t *q = fileq, *last = NULL;
 
-  while (q && q != this) {
+  while (q && q != thisfile) {
     last = q;
     q = q->next;
   }
@@ -147,42 +145,42 @@ static void flush_fileq(char *to)
 
 static void send_next_file(char *to)
 {
-  fileq_t *q = NULL, *this = NULL;
+  fileq_t *q = NULL, *thisfile = NULL;
   char *s = NULL, *s1 = NULL;
   int x;
 
   for (q = fileq; q; q = q->next)
     if (!egg_strcasecmp(q->to, to))
-      this = q;
-  if (this == NULL)
+      thisfile = q;
+  if (thisfile == NULL)
     return;			/* None */
   /* Copy this file to /tmp */
-  if (this->dir[0] == '*') {	/* Absolute path */
-    s = (char *) calloc(1, strlen(&this->dir[1]) + strlen(this->file) + 2);
-    sprintf(s, "%s/%s", &this->dir[1], this->file);
+  if (thisfile->dir[0] == '*') {	/* Absolute path */
+    s = (char *) calloc(1, strlen(&thisfile->dir[1]) + strlen(thisfile->file) + 2);
+    sprintf(s, "%s/%s", &thisfile->dir[1], thisfile->file);
   } else {
-    char *p = strchr(this->dir, '*');
+    char *p = strchr(thisfile->dir, '*');
 
     if (p == NULL) {		/* if it's messed up */
       send_next_file(to);
       return;
     }
     p++;
-    s = (char *) calloc(1, strlen(p) + strlen(this->file) + 2);
-    sprintf(s, "%s%s%s", p, p[0] ? "/" : "", this->file);
-    strcpy(this->dir, &(p[atoi(this->dir)]));
+    s = (char *) calloc(1, strlen(p) + strlen(thisfile->file) + 2);
+    sprintf(s, "%s%s%s", p, p[0] ? "/" : "", thisfile->file);
+    strcpy(thisfile->dir, &(p[atoi(thisfile->dir)]));
   }
   if (copy_to_tmp) {
-    s1 = (char *) calloc(1, strlen(tempdir) + strlen(this->file) + 1);
-    sprintf(s1, "%s%s", tempdir, this->file);
+    s1 = (char *) calloc(1, strlen(tempdir) + strlen(thisfile->file) + 1);
+    sprintf(s1, "%s%s", tempdir, thisfile->file);
     if (copyfile(s, s1) != 0) {
       putlog(LOG_FILES | LOG_MISC, "*",
 	     TRANSFER_COPY_FAILED,
-	     this->file, tempdir);
+	     thisfile->file, tempdir);
       dprintf(DP_HELP,
 	      TRANSFER_FILESYS_BROKEN,
-	      this->to);
-      strcpy(s, this->to);
+	      thisfile->to);
+      strcpy(s, thisfile->to);
       flush_fileq(s);
       free(s1);
       free(s);
@@ -191,44 +189,44 @@ static void send_next_file(char *to)
   } else {
     s1 = strdup(s);
   }
-  if (this->dir[0] == '*') {
-    s = (char *) realloc(s, strlen(&this->dir[1]) + strlen(this->file) + 2);
-    sprintf(s, "%s/%s", &this->dir[1], this->file);
+  if (thisfile->dir[0] == '*') {
+    s = (char *) realloc(s, strlen(&thisfile->dir[1]) + strlen(thisfile->file) + 2);
+    sprintf(s, "%s/%s", &thisfile->dir[1], thisfile->file);
   } else {
-    s = (char *) realloc(s, strlen(this->dir) + strlen(this->file) + 2);
-    sprintf(s, "%s%s%s", this->dir, this->dir[0] ? "/" : "", this->file);
+    s = (char *) realloc(s, strlen(thisfile->dir) + strlen(thisfile->file) + 2);
+    sprintf(s, "%s%s%s", thisfile->dir, thisfile->dir[0] ? "/" : "", thisfile->file);
   }
-  x = raw_dcc_send(s1, this->to, this->nick, s);
+  x = raw_dcc_send(s1, thisfile->to, thisfile->nick, s);
   if (x == DCCSEND_OK) {
-    if (egg_strcasecmp(this->to, this->nick))
-      dprintf(DP_HELP, TRANSFER_FILE_ARRIVE, this->to,
-	      this->nick);
-    deq_this(this);
+    if (egg_strcasecmp(thisfile->to, thisfile->nick))
+      dprintf(DP_HELP, TRANSFER_FILE_ARRIVE, thisfile->to,
+	      thisfile->nick);
+    deq_this(thisfile);
     free(s);
     free(s1);
     return;
   }
   wipe_tmp_filename(s1, -1);
   if (x == DCCSEND_FULL) {
-    putlog(LOG_FILES, "*",TRANSFER_LOG_CONFULL, s1, this->nick);
+    putlog(LOG_FILES, "*",TRANSFER_LOG_CONFULL, s1, thisfile->nick);
     dprintf(DP_HELP,
 	    TRANSFER_NOTICE_CONFULL,
-	    this->to);
-    strcpy(s, this->to);
+	    thisfile->to);
+    strcpy(s, thisfile->to);
     flush_fileq(s);
   } else if (x == DCCSEND_NOSOCK) {
-    putlog(LOG_FILES, "*", TRANSFER_LOG_SOCKERR, s1, this->nick);
+    putlog(LOG_FILES, "*", TRANSFER_LOG_SOCKERR, s1, thisfile->nick);
     dprintf(DP_HELP, TRANSFER_NOTICE_SOCKERR,
-	    this->to);
-    strcpy(s, this->to);
+	    thisfile->to);
+    strcpy(s, thisfile->to);
     flush_fileq(s);
   } else {
     if (x == DCCSEND_FEMPTY) {
-      putlog(LOG_FILES, "*", TRANSFER_LOG_FILEEMPTY, this->file);
+      putlog(LOG_FILES, "*", TRANSFER_LOG_FILEEMPTY, thisfile->file);
       dprintf(DP_HELP, TRANSFER_NOTICE_FILEEMPTY,
-	      this->to, this->file);
+	      thisfile->to, thisfile->file);
     }
-    deq_this(this);
+    deq_this(thisfile);
   }
   free(s);
   free(s1);

+ 1 - 1
src/mod/update.mod/update.c

@@ -296,7 +296,7 @@ static void start_sending_binary(int idx)
   dcc[idx].status |= STAT_SENDINGU;
 
   putlog(LOG_BOTS, "*", "Sending binary send request to %s", dcc[idx].nick);
-  sysname = get_user(&USERENTRY_OS, dcc[idx].user);
+  sysname = (char *) get_user(&USERENTRY_OS, dcc[idx].user);
 
   if (!sysname || !sysname[0] || !strcmp("*", sysname)) {
     putlog(LOG_MISC, "*", "Cannot update \002%s\002 automatically, uname not returning os name.", dcc[idx].nick);

+ 3 - 3
src/userent.c

@@ -278,7 +278,7 @@ void config_display(int idx, struct user_entry *e, struct userrec *u)
 
   get_user_flagrec(dcc[idx].user, &fr, NULL);
   /* scan thru xtra field, searching for matches */
-  for (xk = e->u.extra; xk; xk = xk->next) {
+  for (xk = (struct xtra_key *) e->u.extra; xk; xk = xk->next) {
     /* ok, it's a valid xtra field entry */
     if (glob_owner(fr))
       dprintf(idx, "  %s: %s\n", xk->key, xk->data);
@@ -336,7 +336,7 @@ int config_write_userfile(FILE *f, struct userrec *u, struct user_entry *e)
 {
   struct xtra_key *x = NULL;
 
-  for (x = e->u.extra; x; x = x->next)
+  for (x = (struct xtra_key *) e->u.extra; x; x = x->next)
     lfprintf(f, "--CONFIG %s %s\n", x->key, x->data);
   return 1;
 }
@@ -867,7 +867,7 @@ static int hosts_write_userfile(FILE *f, struct userrec *u, struct user_entry *e
 {
   struct list_type *h = NULL;
 
-  for (h = e->u.extra; h; h = h->next)
+  for (h = (struct list_type *) e->u.extra; h; h = h->next)
     if (lfprintf(f, "--HOSTS %s\n", h->extra) == EOF)
       return 0;
   return 1;