ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.1.x/src/parse.c
(Generate patch)

Comparing ircd-hybrid/branches/8.1.x/src/parse.c (file contents):
Revision 2342 by michael, Tue Jun 4 12:19:20 2013 UTC vs.
Revision 2343 by michael, Wed Jul 3 18:13:17 2013 UTC

# Line 54 | Line 54
54   *                               'i' -> [MessageTree *] -> 'e' and matches
55   *
56   * BUGS (Limitations!)
57 < *
57 > *
58   * I designed this trie to parse ircd commands. Hence it currently
59   * casefolds. This is trivial to fix by increasing MAXPTRLEN.
60   * This trie also "folds" '{' etc. down. This means, the input to this
# Line 64 | Line 64
64   * MAXPTRLEN 128.
65   *
66   * This is also not a patricia trie. On short ircd tokens, this is
67 < * not likely going to matter.
67 > * not likely going to matter.
68   *
69   * Diane Bruce (Dianora), June 6 2003
70   */
# Line 88 | Line 88
88  
89   struct MessageTree
90   {
91 <  int links; /* Count of all pointers (including msg) at this node
91 >  int links; /* Count of all pointers (including msg) at this node
92                * used as reference count for deletion of _this_ node.
93                */
94    struct Message *msg;
# Line 131 | Line 131 | parse(struct Client *client_p, char *pbu
131    assert(client_p->localClient->fd.flags.open);
132    assert((bufend - pbuffer) < 512);
133  
134 <  for (ch = pbuffer; *ch == ' '; ++ch) /* skip spaces */
135 <    /* null statement */ ;
134 >  for (ch = pbuffer; *ch == ' '; ++ch)  /* skip spaces */
135 >    /* null statement */  ;
136  
137    if (*ch == ':')
138    {
# Line 153 | Line 153 | parse(struct Client *client_p, char *pbu
153        if ((from = find_person(client_p, sender)) == NULL)
154          from = hash_find_server(sender);
155  
156 <      /* Hmm! If the client corresponding to the
157 <       * prefix is not found--what is the correct
158 <       * action??? Now, I will ignore the message
159 <       * (old IRC just let it through as if the
160 <       * prefix just wasn't there...) --msa
156 >      /*
157 >       * Hmm! If the client corresponding to the prefix is not found--what is
158 >       * the correct action??? Now, I will ignore the message (old IRC just
159 >       * let it through as if the prefix just wasn't there...) --msa
160         */
161        if (from == NULL)
162        {
# Line 184 | Line 183 | parse(struct Client *client_p, char *pbu
183      return;
184    }
185  
186 <  /* Extract the command code from the packet.  Point s to the end
186 >  /*
187 >   * Extract the command code from the packet. Point s to the end
188     * of the command code and calculate the length using pointer
189 <   * arithmetic.  Note: only need length for numerics and *all*
189 >   * arithmetic. Note: only need length for numerics and *all*
190     * numerics must have parameters and thus a space after the command
191     * code. -avalon
192     */
# Line 196 | Line 196 | parse(struct Client *client_p, char *pbu
196        IsDigit(*ch) && IsDigit(*(ch + 1)) && IsDigit(*(ch + 2)))
197    {
198      numeric = ch;
199 <    paramcount = 2; /* destination, and the rest of it */
199 >    paramcount = 2;  /* destination, and the rest of it */
200      ++ServerStats.is_num;
201      s = ch + 3;  /* I know this is ' ' from above if            */
202 <    *s++ = '\0'; /* blow away the ' ', and point s to next part */
202 >    *s++ = '\0';  /* blow away the ' ', and point s to next part */
203    }
204    else
205 <  {
205 >  {
206      unsigned int ii = 0;
207  
208      if ((s = strchr(ch, ' ')) != NULL)
# Line 210 | Line 210 | parse(struct Client *client_p, char *pbu
210  
211      if ((msg_ptr = find_command(ch)) == NULL)
212      {
213 <      /* Note: Give error message *only* to recognized
213 >      /*
214 >       * Note: Give error message *only* to recognized
215         * persons. It's a nightmare situation to have
216         * two programs sending "Unknown command"'s or
217         * equivalent to each other at full blast....
# Line 265 | Line 266 | parse(struct Client *client_p, char *pbu
266         if (*s == ':')
267         {
268           /* The rest is a single parameter */
269 <         para[++parc] = s + (!numeric); /* keep the colon if it's a numeric */
269 >         para[++parc] = s + (!numeric);  /* keep the colon if it's a numeric */
270           break;
271         }
272  
# Line 367 | Line 368 | add_msg_element(struct MessageTree *mtre
368    }
369    else
370    {
371 <    /* *cmd & (MAXPTRLEN-1)
371 >    /*
372 >     * *cmd & (MAXPTRLEN-1)
373       * convert the char pointed to at *cmd from ASCII to an integer
374       * between 0 and MAXPTRLEN.
375       * Thus 'A' -> 0x1 'B' -> 0x2 'c' -> 0x3 etc.
376       */
375
377      if ((ntree_p = mtree_p->pointers[*cmd & (MAXPTRLEN - 1)]) == NULL)
378      {
379        ntree_p = MyMalloc(sizeof(struct MessageTree));
# Line 541 | Line 542 | report_messages(struct Client *source_p)
542  
543   /* cancel_clients()
544   *
545 < * inputs       -
546 < * output       -
547 < * side effects -
545 > * inputs       -
546 > * output       -
547 > * side effects -
548   */
549   static int
550   cancel_clients(struct Client *client_p, struct Client *source_p, char *cmd)
551   {
552 <  /* kill all possible points that are causing confusion here,
552 >  /*
553 >   * Kill all possible points that are causing confusion here,
554     * I'm not sure I've got this all right...
555     * - avalon
556     *
557 <   * knowing avalon, probably not.
557 >   * Knowing avalon, probably not.
558     */
559  
560 <  /* with TS, fake prefixes are a common thing, during the
560 >  /*
561 >   * With TS, fake prefixes are a common thing, during the
562     * connect burst when there's a nick collision, and they
563     * must be ignored rather than killed because one of the
564     * two is surviving.. so we don't bother sending them to
# Line 564 | Line 567 | cancel_clients(struct Client *client_p,
567     * servers to be dropped though, as well as the ones from
568     * non-TS servers -orabidoo
569     */
570 <  /* Incorrect prefix for a server from some connection.  If it is a
570 >  /*
571 >   * Incorrect prefix for a server from some connection. If it is a
572     * client trying to be annoying, just QUIT them, if it is a server
573     * then the same deal.
574     */
# Line 585 | Line 589 | cancel_clients(struct Client *client_p,
589      /* return exit_client(client_p, client_p, &me, "Fake Direction");*/
590    }
591  
592 <  /* Ok, someone is trying to impose as a client and things are
593 <   * confused.  If we got the wrong prefix from a server, send out a
592 >  /*
593 >   * Ok, someone is trying to impose as a client and things are
594 >   * confused. If we got the wrong prefix from a server, send out a
595     * kill, else just exit the lame client.
596     */
597 <  /* If the fake prefix is coming from a TS server, discard it
597 >  /*
598 >   * If the fake prefix is coming from a TS server, discard it
599     * silently -orabidoo
600     *
601     * all servers must be TS these days --is
# Line 608 | Line 614 | cancel_clients(struct Client *client_p,
614  
615   /* remove_unknown()
616   *
617 < * inputs       -
618 < * output       -
619 < * side effects -
617 > * inputs       -
618 > * output       -
619 > * side effects -
620   */
621   static void
622   remove_unknown(struct Client *client_p, char *lsender, char *lbuffer)
623   {
624 <  /* Do kill if it came from a server because it means there is a ghost
624 >  /*
625 >   * Do kill if it came from a server because it means there is a ghost
626     * user on the other server which needs to be removed. -avalon
627     * Tell opers about this. -Taner
628     */
629 <  /* '[0-9]something'  is an ID      (KILL/SQUIT depending on its length)
629 >  /*
630 >   * '[0-9]something'  is an ID      (KILL/SQUIT depending on its length)
631     * 'nodots'          is a nickname (KILL)
632     * 'no.dot.at.start' is a server   (SQUIT)
633     */
# Line 668 | Line 676 | handle_numeric(char numeric[], struct Cl
676    struct Client *target_p = NULL;
677    struct Channel *chptr = NULL;
678  
679 <  /* Avoid trash, we need it to come from a server and have a target  */
679 >  /*
680 >   * Avoid trash, we need it to come from a server and have a target
681 >   */
682    if (parc < 2 || !IsServer(source_p))
683      return;
684  
685    /*
686     * Who should receive this message ? Will we do something with it ?
687 <   *  Note that we use findUser functions, so the target can't be neither
688 <   *  a server, nor a channel (?) nor a list of targets (?) .. u2.10
689 <   *  should never generate numeric replies to non-users anyway
690 <   *  Ahem... it can be a channel actually, csc bots use it :\ --Nem
687 >   * Note that we use findUser functions, so the target can't be neither
688 >   * a server, nor a channel (?) nor a list of targets (?) .. u2.10
689 >   * should never generate numeric replies to non-users anyway
690 >   * Ahem... it can be a channel actually, csc bots use it :\ --Nem
691     */
692    if (IsChanPrefix(*parv[1]))
693      chptr = hash_find_channel(parv[1]);
# Line 691 | Line 701 | handle_numeric(char numeric[], struct Cl
701     * Remap low number numerics, not that I understand WHY.. --Nemesi
702     */
703    /*
704 <   * numerics below 100 talk about the current 'connection', you're not
704 >   * Numerics below 100 talk about the current 'connection', you're not
705     * connected to a remote server so it doesn't make sense to send them
706     * remotely - but the information they contain may be useful, so we
707 <   * remap them up.  Weird, but true.  -- Isomer
707 >   * remap them up. Weird, but true.  -- Isomer
708     */
709    if (numeric[0] == '0')
710      numeric[0] = '1';
# Line 715 | Line 725 | handle_numeric(char numeric[], struct Cl
725   }
726  
727   /* m_not_oper()
728 < * inputs       -
728 > * inputs       -
729   * output       -
730   * side effects - just returns a nastyogram to given user
731   */
# Line 739 | Line 749 | void
749   m_registered(struct Client *client_p, struct Client *source_p,
750               int parc, char *parv[])
751   {
752 <  sendto_one(source_p, form_str(ERR_ALREADYREGISTRED),  
752 >  sendto_one(source_p, form_str(ERR_ALREADYREGISTRED),
753               me.name, source_p->name);
754   }
755  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines