Changeset 752 for branches


Ignore:
Timestamp:
06/24/06 18:22:28 (6 years ago)
Author:
wd
Message:

Update topic to be sent first, update SVSMODE parsing to be more generic and
use the safer user_mode() function as well as fixing a bug in the way it
parses.

Location:
branches/ithildin-1.1/modules/ircd/commands
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/commands/svsmode.c

    r586 r752  
    6060        channel_mode(cli, srv, chan, chan->created, argc - 2, argv + 2, 1); 
    6161    } else if ((cp = find_client(argv[1])) != NULL) { 
    62         /* this is less simple.  svsmode sends +d <x> to set 'services id' on 
    63          * people, and we'll handle that here.  XXX: this is a hack, and we 
    64          * should call user_mode() but we don't. :( */ 
    65         if (isdigit(*argv[oarg])) 
    66             ts = str_conv_int(argv[oarg++], 0); 
    67         else 
    68             ts = 0; 
     62        /* Services setting "client modes."  There's also this sort of like, 
     63         * stupid hack where they send "+d <ts>" which is a 'servicesid' 
     64         * used to track clients on the network.  We one-off support this 
     65         * and treat everything else as a real client mode. */ 
    6966 
    70         if (ts && cp->ts != ts) 
    71             return; /* not the same client */ 
     67        if (argc == 4 && !strcmp(argv[2], "+d")) { 
     68            /* this is so dumb */ 
     69            SVSID(cp) = str_conv_int(argv[3], 0); 
     70        } else if (MYCLIENT(cp)) 
     71            /* Is this our client?  If so do the usermode thing.  Otherwise 
     72             * just pass along the command, we expect a MODE back when it is 
     73             * processed by the user's server. */ 
     74            user_mode(cp, cp, argv + 3, argc - 3, true); 
    7275 
    73         oldmode = cp->modes; 
    74         s = argv[oarg++]; 
    75         while (*s) { 
    76             switch (*s) { 
    77                 case '+': 
    78                     plus = 1; 
    79                     break; 
    80                 case '-': 
    81                     plus = 0; 
    82                     break; 
    83                 case 'd': 
    84                     /* special case to set 'services id' */ 
    85                     if (oarg < argc) 
    86                         SVSID(cp) = str_conv_int(argv[oarg++], 0); 
    87                     break; 
    88                 default: 
    89                     if (plus) 
    90                         usermode_set(*s, NULL, cp, NULL, NULL); 
    91                     else 
    92                         usermode_unset(*s, NULL, cp, NULL, NULL); 
    93                     break; 
    94             } 
    95             s++; 
    96         } 
    97  
    98         if (MYCLIENT(cp))  { 
    99             usermode_diff(oldmode, cp->modes, result, 0); 
    100             if (*result != '\0') { 
    101                 if (cli != NULL) 
    102                     sendto_one_from(cp, cli, NULL, "MODE", ":%s", result); 
    103                 else 
    104                     sendto_one_from(cp, cp, NULL, "MODE", ":%s", result); 
    105             } 
    106         } 
     76        /* XXX: For modes with arguments (none exist - yet) we do not 
     77         * support the idea well.  What we really need to do and don't is to 
     78         * tack on all of argv.. broken. */ 
    10779        if (argc > 3) 
    10880            sendto_serv_butone(sptr, cli, srv, cp->nick, "SVSMODE", 
    109                     "%d %s %s", ts, argv[2], argv[3]); 
     81                    "%s %s", ts, argv[2], argv[3]); 
    11082        else 
    11183            sendto_serv_butone(sptr, cli, srv, cp->nick, "SVSMODE", 
    112                     "%d %s", ts, argv[2]); 
     84                    "%s", ts, argv[2]); 
    11385    } 
    11486} 
  • branches/ithildin-1.1/modules/ircd/commands/topic.c

    r613 r752  
    3737    add_isupport("TOPICLEN", ISUPPORT_FL_INT, (char *)&i64); 
    3838 
    39     add_hook(ircd.events.channel_add, topic_channel_add_hook); 
     39    /* stuff this hook in nice and early so we are always in front of NAMES. 
     40     * THis should be harmless, at least for now.  Some clients seem to 
     41     * depend on speculative wording in RFC1459 that says RPL_TOPIC and 
     42     * RPL_NAMREPLY are sent.  They believe this implies that RPL_TOPIC must 
     43     * be first.  Most clients do not break when this isn't the case, but a 
     44     * few poorly written ones do. */ 
     45    add_hook_before(ircd.events.channel_add, topic_channel_add_hook, NULL); 
     46 
    4047    add_hook(ircd.events.server_establish, topic_server_establish_hook); 
    4148 
Note: See TracChangeset for help on using the changeset viewer.