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

Comparing:
ircd-hybrid-8/modules/m_svsmode.c (file contents), Revision 1159 by michael, Wed Aug 10 21:08:18 2011 UTC vs.
ircd-hybrid/trunk/modules/m_svsmode.c (file contents), Revision 2022 by michael, Sun May 12 18:07:07 2013 UTC

# Line 22 | Line 22
22  
23   /*! \file m_svsmode.c
24   * \brief Includes required functions for processing the SVSMODE command.
25 < * \version $Id: m_admin.c 1144 2011-07-26 19:33:54Z michael $
25 > * \version $Id$
26   */
27  
28   #include "stdinc.h"
29 – #include "handlers.h"
29   #include "client.h"
30   #include "ircd.h"
31   #include "numeric.h"
33 – #include "s_conf.h"
32   #include "s_serv.h"
33   #include "send.h"
34   #include "channel_mode.h"
37 – #include "msg.h"
35   #include "parse.h"
36   #include "modules.h"
37   #include "irc_string.h"
38   #include "s_user.h"
39 + #include "conf.h"
40 + #include "hook.h"
41  
43 – static void ms_svsmode(struct Client *, struct Client *, int, char *[]);
42  
43 < struct Message svsmode_msgtab = {
46 <  "SVSMODE", 0, 0, 0, 0, MFLG_SLOW | MFLG_UNREG, 0,
47 <  {m_ignore, m_ignore, ms_svsmode, m_ignore, m_ignore, m_ignore}
48 < };
49 <
50 < const char *_version = "$Revision: 1144 $";
51 <
52 < void
53 < _modinit(void)
54 < {
55 <  mod_add_cmd(&svsmode_msgtab);
56 < }
57 <
58 < void
59 < _moddeinit(void)
60 < {
61 <  mod_del_cmd(&svsmode_msgtab);
62 < }
63 <
64 <
65 < /*! \brief SVSMODE command handler (called by servers or services)
43 > /*! \brief SVSMODE command handler (called by services)
44   *
45   * \param client_p Pointer to allocated Client struct with physical connection
46   *                 to this server, i.e. with an open socket connected.
# Line 74 | Line 52 | _moddeinit(void)
52   * \note Valid arguments for this command are:
53   *      - parv[0] = sender prefix
54   *      - parv[1] = nickname
55 < *      - parv[2] = TS (or mode, depending on svs version)
56 < *      - parv[3] = mode (or services id if old svs version)
57 < *      - parv[4] = optional arguement (services id)
55 > *      - parv[2] = TS
56 > *      - parv[3] = mode
57 > *      - parv[4] = optional argument (services id, hostname)
58   */
59   static void
60   ms_svsmode(struct Client *client_p, struct Client *source_p,
61             int parc, char *parv[])
62   {
63    struct Client *target_p = NULL;
64 +  const char *m = NULL, *extarg = NULL;
65    int what = MODE_ADD;
66    unsigned int flag = 0, setflags = 0;
88 –  char *m = NULL, *modes = NULL, *extarg = NULL;
67    time_t ts = 0;
68  
69 <  if (!IsService(source_p) || (parc < 3))
69 >  if (!HasFlag(source_p, FLAGS_SERVICE))
70      return;
71  
94 –  if ((parc >= 4) && ((*parv[3] == '+') || (*parv[3] == '-')))
95 –  {
96 –    ts     = atol(parv[2]);
97 –    modes  = parv[3];
98 –    extarg = (parc > 4) ? parv[4] : NULL;
99 –  }
100 –  else
101 –  {
102 –    modes  = parv[2];
103 –    extarg = (parc > 3) ? parv[3] : NULL;
104 –  }
105 –
72    if ((target_p = find_person(client_p, parv[1])) == NULL)
73      return;
74  
75 <  if (ts && (ts != target_p->tsinfo))
75 >  if ((ts = atol(parv[2])) && (ts != target_p->tsinfo))
76      return;
77  
78 +  if (parc > 4 && !EmptyString(parv[4]))
79 +    extarg = parv[4];
80 +
81    setflags = target_p->umodes;
82  
83 <  for (m = modes; *m; ++m)
83 >  for (m = parv[3]; *m; ++m)
84    {
85      switch (*m)
86      {
# Line 121 | Line 90 | ms_svsmode(struct Client *client_p, stru
90        case '-':
91          what = MODE_DEL;
92          break;
93 +
94 +      case 'd':
95 +        if (extarg)
96 +          strlcpy(target_p->svid, extarg, sizeof(target_p->svid));
97 +        break;
98 +
99 +      case 'x':
100 +        if (what == MODE_ADD && extarg)
101 +          user_set_hostmask(target_p, extarg);
102 +        break;
103 +
104        case 'o':
105 <        if (what == MODE_DEL && IsOper(target_p))
105 >        if (what == MODE_DEL && HasUMode(target_p, UMODE_OPER))
106          {
107            ClearOper(target_p);
108            Count.oper--;
# Line 131 | Line 111 | ms_svsmode(struct Client *client_p, stru
111            {
112              dlink_node *dm = NULL;
113  
114 <            detach_conf(target_p, OPER_TYPE);
115 <            ClearOperFlags(target_p);
114 >            detach_conf(target_p, CONF_OPER);
115 >            ClrOFlag(target_p);
116              DelUMode(target_p, ConfigFileEntry.oper_only_umodes);
117  
118             if ((dm = dlinkFindDelete(&oper_list, target_p)) != NULL)
# Line 142 | Line 122 | ms_svsmode(struct Client *client_p, stru
122  
123          break;
124  
125 +      case 'i':
126 +        if (what == MODE_ADD && !HasUMode(target_p, UMODE_INVISIBLE))
127 +        {
128 +          AddUMode(target_p, UMODE_INVISIBLE);
129 +          ++Count.invisi;
130 +        }
131 +
132 +        if (what == MODE_DEL && HasUMode(target_p, UMODE_INVISIBLE))
133 +        {
134 +          DelUMode(target_p, UMODE_INVISIBLE);
135 +          --Count.invisi;
136 +        }
137 +
138 +        break;
139 +
140        case ' ':
141        case '\n':
142        case '\r':
143        case '\t':
144          break;
150 –      case 'd':
151 –        if (extarg && IsDigit(*extarg))
152 –          target_p->servicestamp = strtoul(extarg, NULL, 0);
153 –        break;
145        default:
146          if ((flag = user_modes[(unsigned char)*m]))
147 <          execute_callback(umode_cb, client_p, target_p, what, flag);
147 >        {
148 >          if (what == MODE_ADD)
149 >            AddUMode(target_p, flag);
150 >          else
151 >            DelUMode(target_p, flag);
152 >        }
153 >
154          break;
155      }
156    }
157  
158    if (extarg)
159    {
160 <    sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
160 >    sendto_server(client_p, CAP_TS6, NOCAPS,
161                    ":%s SVSMODE %s %lu %s %s", ID(source_p),
162 <                  ID(target_p), (unsigned long)target_p->tsinfo, modes, extarg);
163 <    sendto_server(client_p, NULL, NOCAPS, CAP_TS6,
162 >                  ID(target_p), (unsigned long)target_p->tsinfo, parv[3], extarg);
163 >    sendto_server(client_p, NOCAPS, CAP_TS6,
164                    ":%s SVSMODE %s %lu %s %s", source_p->name,
165 <                  target_p->name, (unsigned long)target_p->tsinfo, modes, extarg);
165 >                  target_p->name, (unsigned long)target_p->tsinfo, parv[3], extarg);
166    }
167    else
168    {
169 <    sendto_server(client_p, NULL, CAP_TS6, NOCAPS,
169 >    sendto_server(client_p, CAP_TS6, NOCAPS,
170                    ":%s SVSMODE %s %lu %s", ID(source_p),
171 <                  ID(target_p), (unsigned long)target_p->tsinfo, modes);
172 <    sendto_server(client_p, NULL, NOCAPS, CAP_TS6,
171 >                  ID(target_p), (unsigned long)target_p->tsinfo, parv[3]);
172 >    sendto_server(client_p, NOCAPS, CAP_TS6,
173                    ":%s SVSMODE %s %lu %s", source_p->name,
174 <                  target_p->name, (unsigned long)target_p->tsinfo, modes);
174 >                  target_p->name, (unsigned long)target_p->tsinfo, parv[3]);
175    }
176  
177 <  if (MyClient(target_p) && (setflags != target_p->umodes))
177 >  if (MyConnect(target_p) && (setflags != target_p->umodes))
178    {
179      char modebuf[IRCD_BUFSIZE];
180  
181      send_umode(target_p, target_p, setflags, 0xffffffff, modebuf);
182    }
183   }
184 +
185 + static struct Message svsmode_msgtab = {
186 +  "SVSMODE", 0, 0, 4, MAXPARA, MFLG_SLOW, 0,
187 +  {m_ignore, m_ignore, ms_svsmode, m_ignore, m_ignore, m_ignore}
188 + };
189 +
190 + static void
191 + module_init(void)
192 + {
193 +  mod_add_cmd(&svsmode_msgtab);
194 + }
195 +
196 + static void
197 + module_exit(void)
198 + {
199 +  mod_del_cmd(&svsmode_msgtab);
200 + }
201 +
202 + struct module module_entry = {
203 +  .node    = { NULL, NULL, NULL },
204 +  .name    = NULL,
205 +  .version = "$Revision$",
206 +  .handle  = NULL,
207 +  .modinit = module_init,
208 +  .modexit = module_exit,
209 +  .flags   = 0
210 + };

Comparing:
ircd-hybrid-8/modules/m_svsmode.c (property svn:eol-style), Revision 1159 by michael, Wed Aug 10 21:08:18 2011 UTC vs.
ircd-hybrid/trunk/modules/m_svsmode.c (property svn:eol-style), Revision 2022 by michael, Sun May 12 18:07:07 2013 UTC

# Line 0 | Line 1
1 + native

Comparing:
ircd-hybrid-8/modules/m_svsmode.c (property svn:keywords), Revision 1159 by michael, Wed Aug 10 21:08:18 2011 UTC vs.
ircd-hybrid/trunk/modules/m_svsmode.c (property svn:keywords), Revision 2022 by michael, Sun May 12 18:07:07 2013 UTC

# Line 0 | Line 1
1 + Id Revision

Diff Legend

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