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/trunk/modules/m_svsmode.c (file contents):
Revision 3300 by michael, Sat Apr 12 18:26:22 2014 UTC vs.
Revision 5392 by michael, Tue Jan 20 13:40:41 2015 UTC

# Line 2 | Line 2
2   *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3   *
4   *  Copyright (c) 1999 Bahamut development team.
5 < *  Copyright (c) 2011-2014 ircd-hybrid development team
5 > *  Copyright (c) 2011-2015 ircd-hybrid development team
6   *
7   *  This program is free software; you can redistribute it and/or modify
8   *  it under the terms of the GNU General Public License as published by
# Line 16 | Line 16
16   *
17   *  You should have received a copy of the GNU General Public License
18   *  along with this program; if not, write to the Free Software
19 < *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
19 > *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
20   *  USA
21   */
22  
# Line 28 | Line 28
28   #include "stdinc.h"
29   #include "client.h"
30   #include "ircd.h"
31 – #include "s_serv.h"
31   #include "send.h"
32   #include "channel_mode.h"
33   #include "parse.h"
34   #include "modules.h"
35   #include "irc_string.h"
36 < #include "s_user.h"
36 > #include "user.h"
37   #include "conf.h"
38  
39  
# Line 48 | Line 47
47   * \note Valid arguments for this command are:
48   *      - parv[0] = command
49   *      - parv[1] = nickname
50 < *      - parv[2] = TS (or mode, depending on svs version)
51 < *      - parv[3] = mode (or services id if old svs version)
52 < *      - parv[4] = optional argument (services id)
50 > *      - parv[2] = TS
51 > *      - parv[3] = mode
52 > *      - parv[4] = optional argument (services account, vhost)
53   */
54   static int
55   ms_svsmode(struct Client *source_p, int parc, char *parv[])
56   {
57 +  const struct user_modes *tab = NULL;
58    struct Client *target_p = NULL;
59    int what = MODE_ADD;
60 <  unsigned int flag = 0, setmodes = 0;
60 >  unsigned int setmodes = 0;
61    const char *modes = NULL, *extarg = NULL;
62    time_t ts = 0;
63  
64    if (!HasFlag(source_p, FLAGS_SERVICE))
65      return 0;
66  
67 <  if ((parc >= 4) && ((*parv[3] == '+') || (*parv[3] == '-')))
68 <  {
69 <    ts     = atol(parv[2]);
70 <    modes  = parv[3];
71 <    extarg = (parc > 4) ? parv[4] : NULL;
72 <  }
73 <  else
74 <  {
75 <    modes  = parv[2];
76 <    extarg = (parc > 3) ? parv[3] : NULL;
77 <  }
67 >  ts     = atol(parv[2]);
68 >  modes  = parv[3];
69 >  extarg = (parc > 4) ? parv[4] : NULL;
70  
71    if ((target_p = find_person(source_p, parv[1])) == NULL)
72      return 0;
# Line 97 | Line 89 | ms_svsmode(struct Client *source_p, int
89  
90        case 'd':
91          if (!EmptyString(extarg))
92 <          strlcpy(target_p->svid, extarg, sizeof(target_p->svid));
92 >          strlcpy(target_p->account, extarg, sizeof(target_p->account));
93          break;
94  
95        case 'x':
# Line 109 | Line 101 | ms_svsmode(struct Client *source_p, int
101          if (what == MODE_DEL && HasUMode(target_p, UMODE_OPER))
102          {
103            ClearOper(target_p);
104 <          Count.oper--;
104 >          --Count.oper;
105  
106            if (MyConnect(target_p))
107            {
108 <            dlink_node *dm = NULL;
108 >            dlink_node *node = NULL;
109  
110              detach_conf(target_p, CONF_OPER);
111              ClrOFlag(target_p);
112 <            DelUMode(target_p, ConfigFileEntry.oper_only_umodes);
112 >            DelUMode(target_p, ConfigGeneral.oper_only_umodes);
113  
114 <            if ((dm = dlinkFindDelete(&oper_list, target_p)))
115 <              free_dlink_node(dm);
114 >            if ((node = dlinkFindDelete(&oper_list, target_p)))
115 >              free_dlink_node(node);
116            }
117          }
118  
# Line 146 | Line 138 | ms_svsmode(struct Client *source_p, int
138          break;
139  
140        default:
141 <        if ((flag = user_modes[(unsigned char)*m]))
141 >        if ((tab = umode_map[(unsigned char)*m]))
142          {
143            if (what == MODE_ADD)
144 <            AddUMode(target_p, flag);
144 >            AddUMode(target_p, tab->flag);
145            else
146 <            DelUMode(target_p, flag);
146 >            DelUMode(target_p, tab->flag);
147          }
148  
149          break;
# Line 159 | Line 151 | ms_svsmode(struct Client *source_p, int
151    }
152  
153    if (extarg)
154 <    sendto_server(source_p, NOCAPS, NOCAPS, ":%s SVSMODE %s %lu %s %s",
154 >    sendto_server(source_p, 0, 0, ":%s SVSMODE %s %lu %s %s",
155                    source_p->id,
156                    target_p->id, (unsigned long)target_p->tsinfo, modes, extarg);
157    else
158 <    sendto_server(source_p, NOCAPS, NOCAPS, ":%s SVSMODE %s %lu %s",
158 >    sendto_server(source_p, 0, 0, ":%s SVSMODE %s %lu %s",
159                    source_p->id,
160                    target_p->id, (unsigned long)target_p->tsinfo, modes);
161  
# Line 171 | Line 163 | ms_svsmode(struct Client *source_p, int
163    {
164      char modebuf[IRCD_BUFSIZE] = "";
165  
166 <    send_umode(target_p, target_p, setmodes, 0xffffffff, modebuf);
166 >    send_umode(target_p, target_p, setmodes, modebuf);
167    }
168  
169    return 0;
# Line 179 | Line 171 | ms_svsmode(struct Client *source_p, int
171  
172   static struct Message svsmode_msgtab =
173   {
174 <  "SVSMODE", 0, 0, 3, MAXPARA, MFLG_SLOW, 0,
174 >  "SVSMODE", NULL, 0, 0, 4, MAXPARA, MFLG_SLOW, 0,
175    { m_ignore, m_ignore, ms_svsmode, m_ignore, m_ignore, m_ignore }
176   };
177  

Diff Legend

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