Changeset 748 for branches/ithildin-1.1


Ignore:
Timestamp:
06/03/06 23:25:00 (6 years ago)
Author:
wd
Message:
  • Re-set TS when we get a TS change from upstream (d'oh)
  • Make sure sendflag data is better initialized
  • Change the way we send the notice from /version to not rely on preprocessor definitions.
  • Cleanup some comments.
Location:
branches/ithildin-1.1/modules/ircd
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/client.h

    r703 r748  
    1212 
    1313struct client { 
    14     char    nick[NICKLEN + 1];        /* nickname */ 
    15     char    user[USERLEN + 1];        /* username on IRC (different from username 
    16                                    in conn */ 
    17     char    host[HOSTLEN + 1];        /* hostname on IRC */ 
    18     char    *orighost;                /* concession for host-changing modules.  this 
    19                                    will normally point to the 'host' field of 
    20                                    the client, but may be pointed elsewhere if 
    21                                    need be. */ 
    22     char    ip[IPADDR_MAXLEN + 1]; /* IP address (NICKIP) */ 
    23     char    info[GCOSLEN + 1];        /* gecos/gcos info (ircname) */ 
     14    char    nick[NICKLEN + 1];      /* nickname */ 
     15    char    user[USERLEN + 1];      /* username on IRC (different from username 
     16                                       in conn */ 
     17    char    host[HOSTLEN + 1];      /* hostname on IRC */ 
     18    char    *orighost;              /* concession for host-changing modules.  this 
     19                                       will normally point to the 'host' field of 
     20                                       the client, but may be pointed elsewhere if 
     21                                       need be. */ 
     22    char    ip[IPADDR_MAXLEN + 1];  /* IP address (NICKIP) */ 
     23    char    info[GCOSLEN + 1];      /* gecos/gcos info (ircname) */ 
    2424 
    2525#define IRCD_CLIENT_REGISTERED        0x0001 
     
    2828#define IRCD_CLIENT_KILLED        0x0002 
    2929#define IRCD_CLIENT_HISTORY        0x0004 
    30     int            flags; 
     30    int     flags; 
    3131 
    3232    /* check to see if this is our client.  we know it's ours if their server 
     
    3535#define MYCLIENT(cli) (cli->server == ircd.me) 
    3636    struct connection *conn;        /* the connection for this client, NULL if 
    37                                    remote or pseudo-client. */ 
     37                                       remote or pseudo-client. */ 
    3838 
    39     time_t  signon;                /* signon time */ 
    40     time_t  ts;                        /* timestamp of the nickname */ 
    41     time_t  last;                /* used for idle time (different from 
    42                                    conn->last) */ 
    43     int            hops;                /* how many hops away are they? */ 
    44     uint64_t modes;                /* the user's modes, see below */ 
     39    time_t  signon;                 /* signon time */ 
     40    time_t  ts;                     /* timestamp of the nickname */ 
     41    time_t  last;                   /* used for idle time (different from 
     42                                       conn->last) */ 
     43    int     hops;                   /* how many hops away are they? */ 
     44    uint64_t modes;                 /* the user's modes, see below */ 
    4545 
    46     struct userchans chans;        /* our channels */ 
     46    struct userchans chans;         /* our channels */ 
    4747 
    48     struct privilege_set *pset;        /* privileges (usually derived from class) */ 
    49     struct server *server;        /* server which owns this client */ 
     48    struct privilege_set *pset;     /* privileges (usually derived from class) */ 
     49    struct server *server;          /* server which owns this client */ 
    5050 
    5151    struct client_history *hist; 
    5252 
    53     char    *mdext;                /* mdext data */ 
     53    char    *mdext;                 /* mdext data */ 
    5454     
    5555    LIST_ENTRY(client) lp; 
     
    138138 
    139139struct usermode { 
    140     unsigned char mode;                    /* the actual mode */ 
    141     char    avail;                    /* 1 if available, 0 otherwise */ 
    142 #define USERMODE_FL_GLOBAL  0x1            /* the usermode is spread across the 
     140    unsigned char mode;             /* the actual mode */ 
     141    char    avail;                  /* 1 if available, 0 otherwise */ 
     142#define USERMODE_FL_GLOBAL  0x1     /* the usermode is spread across the 
    143143                                       network */ 
    144 #define USERMODE_FL_OPER    0x2            /* the usermode is operator only */ 
     144#define USERMODE_FL_OPER    0x2     /* the usermode is operator only */ 
    145145#define USERMODE_FL_PRESERVE 0x4    /* preserve the mode once set unless 
    146146                                       explicitly unset by the user */ 
    147     int            flags;                    /* flags for the usermode */ 
    148     uint64_t mask;                    /* the bitmask for the mode */ 
    149     msymbol_t *changer;                    /* the changer function for the mode */ 
    150     int sflag;                            /* send flag (if any) for this mode. */ 
     147    int     flags;                  /* flags for the usermode */ 
     148    uint64_t mask;                  /* the bitmask for the mode */ 
     149    msymbol_t *changer;             /* the changer function for the mode */ 
     150    int     sflag;                  /* send flag (if any) for this mode. */ 
    151151}; 
    152152 
    153153TAILQ_HEAD(client_history_list, client_history); 
    154154struct client_history { 
    155     char    nick[NICKLEN + 1];            /* these are all the same as in the */ 
     155    char    nick[NICKLEN + 1];      /* these are all the same as in the */ 
    156156    char    serv[SERVLEN + 1]; 
    157157 
    158     client_t *cli;                    /* points to the client we created this 
     158    client_t *cli;                  /* points to the client we created this 
    159159                                       from.  for currently online clients the 
    160160                                       nick will be different. */ 
    161     time_t  signoff;                    /* when the client signed off */ 
     161    time_t  signoff;                /* when the client signed off */ 
    162162 
    163163    TAILQ_ENTRY(client_history) lp; 
     
    175175 * functions when checking for access */ 
    176176struct client_check_args { 
    177     client_t *from;        /* the client performing the action */ 
    178     client_t *to;        /* the client being acted on */ 
    179     char    *extra;        /* any extra data */ 
     177    client_t *from;                 /* the client performing the action */ 
     178    client_t *to;                   /* the client being acted on */ 
     179    char    *extra;                 /* any extra data */ 
    180180}; 
    181181 
    182 #define CLIENT_CHECK_OVERRIDE        HOOK_COND_SPASS 
    183 #define CLIENT_CHECK_OK                HOOK_COND_PASS 
    184 #define CLIENT_CHECK_NO                HOOK_COND_FAIL 
     182#define CLIENT_CHECK_OVERRIDE   HOOK_COND_SPASS 
     183#define CLIENT_CHECK_OK         HOOK_COND_PASS 
     184#define CLIENT_CHECK_NO         HOOK_COND_FAIL 
    185185int client_check_access(client_t *, client_t *, char *, event_t *); 
    186186#define can_can_send_client(from, to, arg) \ 
  • branches/ithildin-1.1/modules/ircd/commands/mode.c

    r733 r748  
    8989                        &argv[2], 1); 
    9090        } else { 
    91             return channel_mode(cli, NULL, chan, 0, argc - 2, &argv[2], 1); 
     91            return channel_mode(cli, NULL, chan, chan->created, argc - 2, 
     92                    &argv[2], 1); 
    9293        } 
    9394    } else if ((cp = find_client(argv[1])) != NULL) { 
     
    328329             * remove our own modes (because we believe the server will 
    329330             * accept our modes as stupidly as we accepted theirs... */ 
    330             log_debug("server %s has no support TS, setting TS for %s to 0!", 
     331            log_debug("server %s has no TS support, setting TS for %s to 0!", 
    331332                    sp->name, chan->name); 
    332333            ts = 0; 
     334            chan->created = 0; /* normally set when we reject our modes, but 
     335                                  we don't reject our modes in this case..  */ 
    333336        } else { 
    334337            if (ts > chan->created) 
     
    386389        log_debug("reverting our modes for channel %s (ours=%d, theirs=%d", 
    387390                chan->name, chan->created, ts); 
     391        chan->created = ts; 
    388392 
    389393        s = ircd.cmodes.avail; 
  • branches/ithildin-1.1/modules/ircd/commands/quit.c

    r746 r748  
    3737 
    3838    if (MYCLIENT(cli)) { 
     39        snprintf(fmsg, TOPICLEN, MSG_FMT(cli, quit_format), msg); 
     40        fmsg[TOPICLEN] = '\0'; 
     41 
    3942        /* We check to see if their message would be moderated in any channels 
    4043         * they are in.  If this is the case they are parted from the channels 
    4144         * before the quit is sent. */ 
    42         if (!CLIENT_MASTER(cli) && *msg != '\0') { 
     45        if (!CLIENT_MASTER(cli) && *fmsg != '\0') { 
    4346            clp = LIST_FIRST(&cli->chans); 
    4447            while (clp != NULL) { 
    4548                clp2 = LIST_NEXT(clp, lpcli); 
    4649 
    47                 if (can_can_send_channel(cli, clp->chan, msg) >= 0) { 
     50                if (can_can_send_channel(cli, clp->chan, fmsg) >= 0) { 
    4851                    sendto_channel_local(clp->chan, cli, NULL, "PART", NULL); 
    4952                    sendto_serv_butone(sptr, cli, NULL, clp->chan->name, 
     
    5558        } 
    5659 
    57         /* if it's our client, the connection will be closed.  we check here 
    58          * because we can't after a destroy_client() */ 
    59         snprintf(fmsg, TOPICLEN, MSG_FMT(cli, quit_format), msg); 
    60         fmsg[TOPICLEN] = '\0'; 
     60        /* Be sure to return appropriately for our local clients */ 
    6161        destroy_client(cli, fmsg); 
    6262        return IRCD_CONNECTION_CLOSED; 
     63    } else { 
     64        destroy_client(cli, msg); 
     65        return COMMAND_WEIGHT_NONE; 
    6366    } 
    64     destroy_client(cli, msg); 
    65     return COMMAND_WEIGHT_NONE; 
    6667} 
    6768 
  • branches/ithildin-1.1/modules/ircd/commands/version.c

    r740 r748  
    4040            ircd.vercomment); 
    4141    send_isupport(cli); 
    42 #ifdef DEBUG_CODE 
    43     sendto_one(cli, "NOTICE", ":This server is running in debug mode. " 
    44             "Some traffic may be logged."); 
    45 #endif 
     42    if (me.debug) 
     43        sendto_one(cli, "NOTICE", ":This server is running in debug mode. " 
     44                "Some traffic may be logged."); 
    4645 
    4746    return COMMAND_WEIGHT_MEDIUM; 
  • branches/ithildin-1.1/modules/ircd/send.c

    r621 r748  
    608608    } 
    609609    free(ircd.sflag.flags[flg].name); 
     610 
     611    memset(&ircd.sflag.flags[flg], 0, sizeof(struct send_flag)); 
    610612    ircd.sflag.flags[flg].num = -1; 
    611613} 
     
    631633 
    632634    /* otherwise, put them in. */ 
    633     clp = malloc(sizeof(struct chanlink)); 
     635    clp = calloc(1, sizeof(struct chanlink)); 
    634636    clp->cli = cli; 
    635637    clp->chan = NULL; 
     
    672674    char lmsg[512]; 
    673675    va_list vl; 
    674          
     676 
    675677    if (flg < 0 || flg >= ircd.sflag.size || ircd.sflag.flags[flg].num < 0) 
    676678        return; /* nothing to do here. */ 
Note: See TracChangeset for help on using the changeset viewer.