Просмотр исходного кода

* Removed dupuser crap

svn: 940
Bryan Drewery 22 лет назад
Родитель
Сommit
421f7687a9
6 измененных файлов с 8 добавлено и 135 удалено
  1. 0 1
      src/flags.c
  2. 0 12
      src/mod/console.mod/console.c
  3. 0 1
      src/mod/notes.mod/notes.c
  4. 8 45
      src/mod/share.mod/share.c
  5. 0 74
      src/userent.c
  6. 0 2
      src/users.h

+ 0 - 1
src/flags.c

@@ -506,7 +506,6 @@ struct user_entry_type USERENTRY_BOTFL =
 {
   0,				/* always 0 ;) */
   0,
-  def_dupuser,
   botfl_unpack,
 #ifdef HUB
   botfl_write_userfile,

+ 0 - 12
src/mod/console.mod/console.c

@@ -189,22 +189,10 @@ static void console_display(int idx, struct user_entry *e, struct userrec *u)
   }
 }
 
-static int console_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  struct console_info *i = e->u.extra, *j = NULL;
-
-  j = calloc(1, sizeof(struct console_info));
-  egg_memcpy(j, i, sizeof(struct console_info));
-
-  j->channel = strdup(i->channel);
-  return set_user(e->type, new, j);
-}
-
 static struct user_entry_type USERENTRY_CONSOLE =
 {
   0,				/* always 0 ;) */
   console_gotshare,
-  console_dupuser,
   console_unpack,
 #ifdef HUB
   console_write_userfile,

+ 0 - 1
src/mod/notes.mod/notes.c

@@ -38,7 +38,6 @@ static struct user_entry_type USERENTRY_FWD =
   NULL,				/* always 0 ;) */
   NULL,
   NULL,
-  NULL,
 #ifdef HUB
   NULL,
 #endif /* HUB */

+ 8 - 45
src/mod/share.mod/share.c

@@ -1329,6 +1329,7 @@ finish_share(int idx)
 
   noshare = 1;
   fr.match = (FR_CHAN | FR_BOT);
+
   while (global_bans)
     u_delmask('b', NULL, global_bans->mask, 1);
   while (global_ign)
@@ -1337,6 +1338,7 @@ finish_share(int idx)
     u_delmask('I', NULL, global_invites->mask, 1);
   while (global_exempts)
     u_delmask('e', NULL, global_exempts->mask, 1);
+
   for (chan = chanset; chan; chan = chan->next) {
     while (chan->bans)
       u_delmask('b', chan, chan->bans->mask, 1);
@@ -1365,11 +1367,12 @@ finish_share(int idx)
   loading = 1;
   checkchans(0);                /* flag all the channels.. */
   Context;
-  if (!readuserfile(dcc[idx].u.xfer->filename, &u)) {
+  if (!readuserfile(dcc[idx].u.xfer->filename, &u)) {		/* read the userfile into 'u' */
+    /* FAILURE */
     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);
     clear_userlist(u);          /* Clear new, obsolete, user list.      */
     clear_chanlist();           /* Remove all user references from the
                                  * channel lists.                       */
@@ -1397,7 +1400,9 @@ finish_share(int idx)
     return;
   }
 
-  unlink(dcc[idx].u.xfer->filename);    //I mean really, shit fills up the quota fast.
+  /* SUCCESS! */
+
+  unlink(dcc[idx].u.xfer->filename);    
 
   loading = 0;
 
@@ -1409,50 +1414,8 @@ finish_share(int idx)
 
   /*
    * Migrate:
-   *   - old channel flags over (unshared channels see)
    *   - unshared (got_share == 0) user entries
-   *   - old bot flags and passwords
    */
-  noshare = 1;
-  fr.match = (FR_CHAN | FR_BOT);
-  for (u = userlist; u; u = u->next) {
-    struct userrec *u2 = get_user_by_handle(ou, u->handle);
-
-    if (u2 && (u2->flags & USER_BOT)) {
-      /* We knew this bot before, copy flags and the password back over. */
-      set_user(&USERENTRY_BOTFL, u, get_user(&USERENTRY_BOTFL, u2));
-      set_user(&USERENTRY_PASS, u, get_user(&USERENTRY_PASS, u2));
-    } else if (u->flags & USER_BOT) {
-      /* This bot was unknown to us, reset it's flags and password. */
-      set_user(&USERENTRY_BOTFL, u, NULL);
-      set_user(&USERENTRY_PASS, u, NULL);
-    } else if (u2 && !(u2->flags & (USER_BOT))) {
-      struct chanuserrec *cr = NULL, *cr_next = NULL, *cr_old = NULL;
-      struct user_entry *ue = NULL;
-
-      for (cr = u2->chanrec; cr; cr = cr_next) {
-        struct chanset_t *mychan = findchan_by_dname(cr->channel);
-
-        cr_next = cr->next;
-        if (mychan) {
-          get_user_flagrec(dcc[j].user, &fr, mychan->dname);
-        }
-        /* Shared channel, still keep old laston time */
-        for (cr_old = u->chanrec; cr_old; cr_old = cr_old->next)
-          if (!rfc_casecmp(cr_old->channel, cr->channel)) {
-            cr_old->laston = cr->laston;
-            break;
-          }
-        cr_old = cr;
-      }
-
-      /* Any unshared user entries need copying over */
-      for (ue = u2->entries; ue; ue = ue->next)
-        if (ue->type && !ue->type->got_share && ue->type->dup_user)
-          ue->type->dup_user(u, u2, ue);
-    }
-  }
-  noshare = 0;
   clear_userlist(ou);
   
   unlink(dcc[idx].u.xfer->filename);    /* Done with you!               */

+ 0 - 74
src/userent.c

@@ -130,11 +130,6 @@ void def_display(int idx, struct user_entry *e, struct userrec *u)
 }
 
 
-int def_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  return set_user(e->type, new, e->u.string);
-}
-
 static void comment_display(int idx, struct user_entry *e, struct userrec *u)
 {
   if (dcc[idx].user && (dcc[idx].user->flags & USER_MASTER))
@@ -145,7 +140,6 @@ struct user_entry_type USERENTRY_COMMENT =
 {
   0,				/* always 0 ;) */
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -161,7 +155,6 @@ struct user_entry_type USERENTRY_INFO =
 {
   0,				/* always 0 ;) */
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -201,7 +194,6 @@ void added_display(int idx, struct user_entry *e, struct userrec *u)
 struct user_entry_type USERENTRY_ADDED = {
   0,				/* always 0 ;) */
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -341,20 +333,6 @@ int config_gotshare(struct userrec *u, struct user_entry *e, char *buf, int idx)
   return 1;
 }
 
-int config_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  struct xtra_key *x1 = NULL, *x2 = NULL;
-
-  for (x1 = e->u.extra; x1; x1 = x1->next) {
-    x2 = calloc(1, sizeof(struct xtra_key));
-
-    x2->key = strdup(x1->key);
-    x2->data = strdup(x1->data);
-    set_user(&USERENTRY_CONFIG, new, x2);
-  }
-  return 1;
-}
-
 #ifdef HUB
 int config_write_userfile(FILE *f, struct userrec *u, struct user_entry *e)
 {
@@ -383,7 +361,6 @@ int config_kill(struct user_entry *e)
 struct user_entry_type USERENTRY_CONFIG = {
   0,
   config_gotshare,
-  config_dupuser,
   config_unpack,
 #ifdef HUB
   config_write_userfile,
@@ -437,7 +414,6 @@ void stats_display(int idx, struct user_entry *e, struct userrec *u)
 struct user_entry_type USERENTRY_STATS = {
   0,				/* always 0 ;) */
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -484,7 +460,6 @@ struct user_entry_type USERENTRY_MODIFIED =
 {
   0,
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -530,7 +505,6 @@ struct user_entry_type USERENTRY_PASS =
 {
   0,
   def_gotshare,
-  NULL,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -566,7 +540,6 @@ struct user_entry_type USERENTRY_SECPASS =
 {
   0,
   def_gotshare,
-  def_dupuser,
   def_unpack,
 #ifdef HUB
   def_write_userfile,
@@ -632,25 +605,10 @@ static int laston_set(struct userrec *u, struct user_entry *e, void *buf)
   return 1;
 }
 
-static int laston_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  struct laston_info *li = e->u.extra, *li2 = NULL;
-
-  if (li) {
-    li2 = calloc(1, sizeof(struct laston_info));
-
-    li2->laston = li->laston;
-    li2->lastonplace = strdup(li->lastonplace);
-    return set_user(&USERENTRY_LASTON, new, li2);
-  }
-  return 0;
-}
-
 struct user_entry_type USERENTRY_LASTON =
 {
   0,				/* always 0 ;) */
   0,
-  laston_dupuser,
   laston_unpack,
 #ifdef HUB
   laston_write_userfile,
@@ -800,32 +758,10 @@ static int botaddr_gotshare(struct userrec *u, struct user_entry *e, char *buf,
   return botaddr_set(u, e, bi);
 }
 
-static int botaddr_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  if (old->flags & USER_BOT) {
-    struct bot_addr *bi = e->u.extra;
-
-    if (bi) {
-      struct bot_addr *bi2 = NULL;
-
-      bi2 = calloc(1, sizeof(struct bot_addr));
-
-      bi2->telnet_port = bi->telnet_port;
-      bi2->relay_port = bi->relay_port;
-      bi2->hublevel = bi->hublevel;
-      bi2->address = strdup(bi->address);
-      bi2->uplink = strdup(bi->uplink);
-      return set_user(&USERENTRY_BOTADDR, new, bi2);
-    }
-  }
-  return 0;
-}
-
 struct user_entry_type USERENTRY_BOTADDR =
 {
   0,				/* always 0 ;) */
   botaddr_gotshare,
-  botaddr_dupuser,
   botaddr_unpack,
 #ifdef HUB
   botaddr_write_userfile,
@@ -837,15 +773,6 @@ struct user_entry_type USERENTRY_BOTADDR =
   "BOTADDR"
 };
 
-static int hosts_dupuser(struct userrec *new, struct userrec *old, struct user_entry *e)
-{
-  struct list_type *h = NULL;
-
-  for (h = e->u.extra; h; h = h->next)
-    set_user(&USERENTRY_HOSTS, new, h->extra);
-  return 1;
-}
-
 static int hosts_null(struct userrec *u, struct user_entry *e)
 {
   return 1;
@@ -957,7 +884,6 @@ struct user_entry_type USERENTRY_HOSTS =
 {
   0,
   hosts_gotshare,
-  hosts_dupuser,
   hosts_null,
 #ifdef HUB
   hosts_write_userfile,

+ 0 - 2
src/users.h

@@ -33,8 +33,6 @@ struct user_entry;
 struct user_entry_type {
   struct user_entry_type *next;
   int (*got_share) (struct userrec *, struct user_entry *, char *, int);
-  int (*dup_user) (struct userrec *, struct userrec *,
-		   struct user_entry *);
   int (*unpack) (struct userrec *, struct user_entry *);
 #ifdef HUB
   int (*write_userfile) (FILE *, struct userrec *, struct user_entry *);