/[svn]/ircd-hybrid-7.2/src/s_user.c
ViewVC logotype

Diff of /ircd-hybrid-7.2/src/s_user.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 572 by michael, Sat Mar 18 15:13:11 2006 UTC revision 573 by michael, Mon May 1 09:40:37 2006 UTC
# Line 423  register_local_user(struct Client *clien Line 423  register_local_user(struct Client *clien
423    if (IsDead(client_p))    if (IsDead(client_p))
424      return;      return;
425    
426    if (source_p->id[0] == '\0' && me.id[0])    if (me.id[0])
427    {    {
428      char *id = (char *)execute_callback(uid_get_cb, source_p);      const char *id = execute_callback(uid_get_cb, source_p);
429    
430      while (hash_find_id(id) != NULL)      while (hash_find_id(id) != NULL)
431        id = uid_get(NULL);        id = uid_get(NULL);
432    
# Line 1113  void Line 1114  void
1114  send_umode_out(struct Client *client_p, struct Client *source_p,  send_umode_out(struct Client *client_p, struct Client *source_p,
1115                 unsigned int old)                 unsigned int old)
1116  {  {
1117    char buf[IRCD_BUFSIZE];    char buf[IRCD_BUFSIZE] = { '\0' };
1118    dlink_node *ptr = NULL;    dlink_node *ptr = NULL;
1119    
1120    send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ?    send_umode(NULL, source_p, old, IsOperHiddenAdmin(source_p) ?
1121               SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf);               SEND_UMODES & ~UMODE_ADMIN : SEND_UMODES, buf);
1122    
1123    if (*buf)    if (buf[0])
1124    {    {
1125      DLINK_FOREACH(ptr, serv_list.head)      DLINK_FOREACH(ptr, serv_list.head)
1126      {      {
# Line 1325  oper_up(struct Client *source_p) Line 1326  oper_up(struct Client *source_p)
1326    send_message_file(source_p, &ConfigFileEntry.opermotd);    send_message_file(source_p, &ConfigFileEntry.opermotd);
1327  }  }
1328    
1329  /*  static char new_uid[TOTALSIDUID + 1];     /* allow for \0 */
  * Quick and dirty UID code for new proposed SID on EFnet  
  *  
  */  
1330    
1331  static char new_uid[TOTALSIDUID+1];     /* allow for \0 */  int
1332  static void add_one_to_uid(int i);  valid_sid(const char *sid)
1333    {
1334    
1335      if (strlen(sid) == IRC_MAXSID)
1336        if (IsDigit(*sid))
1337          if (IsUpper(*(sid + 1)) && IsUpper(*(sid + 2)))
1338            return 1;
1339    
1340      return 0;
1341    }
1342    
1343  /*  /*
1344   * init_uid()   * init_uid()
# Line 1351  init_uid(void) Line 1358  init_uid(void)
1358    
1359    if (ServerInfo.sid != NULL)    if (ServerInfo.sid != NULL)
1360    {    {
1361      memcpy(new_uid, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),      strlcpy(new_uid, ServerInfo.sid, sizeof(new_uid));
1362                                               IRC_MAXSID));      strlcpy(me.id, ServerInfo.sid, sizeof(me.id));
1363      memcpy(&me.id, ServerInfo.sid, IRCD_MIN(strlen(ServerInfo.sid),  
                                             IRC_MAXSID));  
1364      hash_add_id(&me);      hash_add_id(&me);
1365    }    }
1366    
# Line 1362  init_uid(void) Line 1368  init_uid(void)
1368      if (new_uid[i] == '\0')      if (new_uid[i] == '\0')
1369        new_uid[i] = 'A';        new_uid[i] = 'A';
1370    
1371    /* XXX if IRC_MAXUID != 6, this will have to be rewritten */    /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1372    /* Yes nenolod, I have known it was off by one ever since I wrote it    /* Yes nenolod, I have known it was off by one ever since I wrote it
1373     * But *JUST* for you, though, it really doesn't look as *pretty*     * But *JUST* for you, though, it really doesn't look as *pretty*
1374     * -Dianora     * -Dianora
1375     */     */
1376    memcpy(new_uid+IRC_MAXSID, "AAAAA@", IRC_MAXUID);    memcpy(new_uid + IRC_MAXSID, "AAAAA@", IRC_MAXUID);
1377    
1378    entering_umode_cb = register_callback("entering_umode", NULL);    entering_umode_cb = register_callback("entering_umode", NULL);
1379    umode_cb = register_callback("changing_umode", change_simple_umode);    umode_cb = register_callback("changing_umode", change_simple_umode);
# Line 1375  init_uid(void) Line 1381  init_uid(void)
1381  }  }
1382    
1383  /*  /*
  * uid_get  
  *  
  * inputs       - struct Client *  
  * output       - new UID is returned to caller  
  * side effects - new_uid is incremented by one.  
  */  
 static void *  
 uid_get(va_list args)  
 {  
   add_one_to_uid(TOTALSIDUID-1);    /* index from 0 */  
   return ((void *) new_uid);  
 }  
   
 /*  
1384   * add_one_to_uid   * add_one_to_uid
1385   *   *
1386   * inputs       - index number into new_uid   * inputs       - index number into new_uid
# Line 1408  add_one_to_uid(int i) Line 1400  add_one_to_uid(int i)
1400        new_uid[i] = 'A';        new_uid[i] = 'A';
1401        add_one_to_uid(i-1);        add_one_to_uid(i-1);
1402      }      }
1403      else new_uid[i] = new_uid[i] + 1;      else
1404          ++new_uid[i];
1405    }    }
1406    else    else
1407    {    {
1408      /* XXX if IRC_MAXUID != 6, this will have to be rewritten */      /* NOTE: if IRC_MAXUID != 6, this will have to be rewritten */
1409      if (new_uid[i] == 'Z')      if (new_uid[i] == 'Z')
1410        memcpy(new_uid+IRC_MAXSID, "AAAAAA", IRC_MAXUID);        memcpy(new_uid + IRC_MAXSID, "AAAAAA", IRC_MAXUID);
1411      else      else
1412        new_uid[i] = new_uid[i] + 1;        ++new_uid[i];
1413    }    }
1414  }  }
1415    
1416  /*  /*
1417     * uid_get
1418     *
1419     * inputs       - struct Client *
1420     * output       - new UID is returned to caller
1421     * side effects - new_uid is incremented by one.
1422     */
1423    static void *
1424    uid_get(va_list args)
1425    {
1426      add_one_to_uid(TOTALSIDUID - 1);    /* index from 0 */
1427      return new_uid;
1428    }
1429    
1430    /*
1431   * init_isupport()   * init_isupport()
1432   *   *
1433   * input        - NONE   * input        - NONE

Legend:
Removed from v.572  
changed lines
  Added in v.573

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28