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

Comparing ircd-hybrid/trunk/src/parse.c (file contents):
Revision 2786 by michael, Mon Jan 6 22:33:53 2014 UTC vs.
Revision 3104 by michael, Thu Mar 6 00:07:29 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  parse.c: The message parser.
2 > *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4 < *  Copyright (C) 2002 by the past and present ircd coders, and others.
4 > *  Copyright (c) 1997-2014 ircd-hybrid development team
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 18 | Line 17
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19   *  USA
20 < *
21 < *  $Id$
20 > */
21 >
22 > /*! \file parse.c
23 > * \brief The message parser.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
# Line 37 | Line 39
39   #include "s_user.h"
40   #include "s_serv.h"
41  
42 +
43   /*
44   * (based on orabidoo's parser code)
45   *
# Line 51 | Line 54
54   * 't' points -> [MessageTree *] 'r' -> [MessageTree *] -> 'i'
55   *   -> [MessageTree *] -> [MessageTree *] -> 'e' and matches
56   *
57 < *                               'i' -> [MessageTree *] -> 'e' and matches
57 > *                               'i' -> [MessageTree *] -> 'e' and matches
58   *
59   * BUGS (Limitations!)
60   *
# Line 97 | Line 100 | struct MessageTree
100  
101   static struct MessageTree msg_tree;
102  
103 < /*
101 < * NOTE: parse() should not be called recursively by other functions!
102 < */
103 < static char *sender;
104 < static char *para[MAXPARA + 2]; /* <prefix> + <params> + NULL */
103 > static char *para[MAXPARA + 2]; /* <command> + <params> + NULL */
104  
105   static int cancel_clients(struct Client *, struct Client *, char *);
106   static void remove_unknown(struct Client *, char *, char *);
# Line 140 | Line 139 | parse(struct Client *client_p, char *pbu
139       * Copy the prefix to 'sender' assuming it terminates
140       * with SPACE (or NULL, which is an error, though).
141       */
142 <    sender = ++ch;
142 >    char *sender = ++ch;
143  
144      if ((s = strchr(ch, ' ')) != NULL)
145      {
# Line 210 | Line 209 | parse(struct Client *client_p, char *pbu
209  
210      if ((msg_ptr = find_command(ch)) == NULL)
211      {
212 <      /*
212 >      /*
213         * Note: Give error message *only* to recognized
214         * persons. It's a nightmare situation to have
215         * two programs sending "Unknown command"'s or
# Line 248 | Line 247 | parse(struct Client *client_p, char *pbu
247  
248    /* Note initially true: s==NULL || *(s-1) == '\0' !! */
249  
250 <  para[parc] = from->name;
250 >  para[parc] = ch;
251  
252    if (s)
253    {
# Line 317 | Line 316 | handle_command(struct Message *mptr, str
316      if (!IsServer(client_p))
317      {
318        sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), me.name,
319 <                 EmptyString(hpara[0]) ? "*" : hpara[0], mptr->cmd);
319 >                 client_p->name[0] ? client_p->name : "*", mptr->cmd);
320      }
321      else
322      {
# Line 716 | Line 715 | handle_numeric(char numeric[], struct Cl
715          !HasUMode(target_p, UMODE_OPER))
716        sendto_one(target_p, ":%s %s %s %s", me.name, numeric, target_p->name, parv[2]);
717      else
718 <      sendto_one(target_p, ":%s %s %s %s", ID_or_name(source_p, target_p->from),
719 <                 numeric, ID_or_name(target_p, target_p->from), parv[2]);
718 >      sendto_one(target_p, ":%s %s %s %s", ID_or_name(source_p, target_p),
719 >                 numeric, ID_or_name(target_p, target_p), parv[2]);
720    }
721    else
722 <    sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s %s %s %s",
723 <                         source_p->name, numeric, chptr->chname, parv[2]);
722 >    sendto_channel_butone(source_p, source_p, chptr, 0, "%s %s %s",
723 >                          numeric, chptr->chname, parv[2]);
724   }
725  
726   /* m_not_oper()
# Line 729 | Line 728 | handle_numeric(char numeric[], struct Cl
728   * output       -
729   * side effects - just returns a nastyogram to given user
730   */
731 < void
731 > int
732   m_not_oper(struct Client *client_p, struct Client *source_p,
733             int parc, char *parv[])
734   {
735    sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
736               me.name, source_p->name);
737 +  return 0;
738   }
739  
740 < void
740 > int
741   m_unregistered(struct Client *client_p, struct Client *source_p,
742                 int parc, char *parv[])
743   {
744    sendto_one(source_p, form_str(ERR_NOTREGISTERED), me.name,
745               source_p->name[0] ? source_p->name : "*");
746 +  return 0;
747   }
748  
749 < void
749 > int
750   m_registered(struct Client *client_p, struct Client *source_p,
751               int parc, char *parv[])
752   {
753    sendto_one(source_p, form_str(ERR_ALREADYREGISTRED),
754               me.name, source_p->name);
755 +  return 0;
756   }
757  
758 < void
758 > int
759   m_ignore(struct Client *client_p, struct Client *source_p,
760           int parc, char *parv[])
761   {
762 <  return;
762 >  return 0;
763   }

Diff Legend

– Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)