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

Comparing:
ircd-hybrid-7.2/modules/m_list.c (file contents), Revision 896 by michael, Sat Nov 3 08:54:09 2007 UTC vs.
ircd-hybrid/trunk/modules/m_list.c (file contents), Revision 1834 by michael, Fri Apr 19 19:50:27 2013 UTC

# Line 23 | Line 23
23   */
24  
25   #include "stdinc.h"
26 < #include "tools.h"
27 < #include "handlers.h"
26 > #include "list.h"
27   #include "channel.h"
28   #include "channel_mode.h"
29   #include "client.h"
# Line 32 | Line 31
31   #include "irc_string.h"
32   #include "ircd.h"
33   #include "numeric.h"
34 < #include "s_conf.h"
34 > #include "conf.h"
35   #include "s_serv.h"
36   #include "send.h"
38 #include "list.h"
39 #include "msg.h"
37   #include "parse.h"
38   #include "modules.h"
39   #include "s_user.h"
40 + #include "memory.h"
41  
44 static void m_list(struct Client *, struct Client *, int, char *[]);
45 static void mo_list(struct Client *, struct Client *, int, char *[]);
46
47 struct Message list_msgtab = {
48  "LIST", 0, 0, 0, 0, MFLG_SLOW, 0,
49  {m_unregistered, m_list, m_ignore, m_ignore, mo_list, m_ignore}
50 };
51
52 #ifndef STATIC_MODULES
53 void
54 _modinit(void)
55 {
56  mod_add_cmd(&list_msgtab);
57  add_isupport("ELIST", "CMNTU", -1);
58  add_isupport("SAFELIST", NULL, -1);
59 }
60
61 void
62 _moddeinit(void)
63 {
64  mod_del_cmd(&list_msgtab);
65  delete_isupport("ELIST");
66  delete_isupport("SAFELIST");
67 }
68
69 const char *_version = "$Revision$";
70 #endif
71
72 static int
73 has_wildcards(const char *s)
74 {
75  char c;
76
77  while ((c = *s++))
78    if (IsMWildChar(c))
79      return 1;
80
81  return 0;
82 }
42  
43   static void
44   do_list(struct Client *source_p, int parc, char *parv[])
# Line 104 | Line 63 | do_list(struct Client *source_p, int par
63  
64    if (parc > 1)
65    {
66 <    char *opt, *save;
66 >    char *opt, *save = NULL;
67      dlink_list *list;
68      int i, errors = 0;
69  
# Line 113 | Line 72 | do_list(struct Client *source_p, int par
72        switch (*opt)
73        {
74          case '<': if ((i = atoi(opt + 1)) > 0)
75 <                    lt->users_max = (unsigned int) i - 1;
75 >                    lt->users_max = (unsigned int) i - 1;
76                    else
77 <                    errors = 1;
78 <                  break;
77 >                    errors = 1;
78 >                  break;
79          case '>': if ((i = atoi(opt + 1)) >= 0)
80 <                    lt->users_min = (unsigned int) i + 1;
81 <                  else
82 <                    errors = 1;
83 <                  break;
80 >                    lt->users_min = (unsigned int) i + 1;
81 >                  else
82 >                    errors = 1;
83 >                  break;
84          case '-': break;
85          case 'C':
86 <        case 'c': switch (*++opt)
87 <                  {
86 >        case 'c': switch (*++opt)
87 >                  {
88                      case '<': if ((i = atoi(opt + 1)) >= 0)
89                                  lt->created_max = (unsigned int) (CurrentTime
90                                                    - 60 * i);
# Line 175 | Line 134 | do_list(struct Client *source_p, int par
134                     errors = 1;
135                   if (!errors)
136                   {
137 <                   char *s;
179 <                   DupString(s, opt);
137 >                   char *s = xstrdup(opt);
138                     dlinkAdd(s, make_dlink_node(), list);
139                   }
140        }
# Line 199 | Line 157 | do_list(struct Client *source_p, int par
157   }
158  
159   /*
160 < ** m_list
160 > ** mo_list
161   **      parv[0] = sender prefix
162   **      parv[1] = channel
163   */
164   static void
165 < m_list(struct Client *client_p, struct Client *source_p,
166 <       int parc, char *parv[])
165 > m_list(struct Client *client_p, struct Client *source_p,
166 >        int parc, char *parv[])
167   {
168 <  static time_t last_used = 0;
169 <
212 <  if (((last_used + ConfigFileEntry.pace_wait) > CurrentTime))
213 <  {
214 <    sendto_one(source_p,form_str(RPL_LOAD2HI),me.name,parv[0]);
215 <    return;
216 <  }
168 >  do_list(source_p, parc, parv);
169 > }
170  
171 <  last_used = CurrentTime;
171 > static struct Message list_msgtab = {
172 >  "LIST", 0, 0, 0, MAXPARA, MFLG_SLOW, 0,
173 >  { m_unregistered, m_list, m_ignore, m_ignore, m_list, m_ignore }
174 > };
175  
176 <  do_list(source_p, parc, parv);
176 > static void
177 > module_init(void)
178 > {
179 >  mod_add_cmd(&list_msgtab);
180 >  add_isupport("ELIST", "CMNTU", -1);
181 >  add_isupport("SAFELIST", NULL, -1);
182   }
183  
223 /*
224 ** mo_list
225 **      parv[0] = sender prefix
226 **      parv[1] = channel
227 */
184   static void
185 < mo_list(struct Client *client_p, struct Client *source_p,
230 <        int parc, char *parv[])
185 > module_exit(void)
186   {
187 <  do_list(source_p, parc, parv);
187 >  mod_del_cmd(&list_msgtab);
188 >  delete_isupport("ELIST");
189 >  delete_isupport("SAFELIST");
190   }
191 +
192 + struct module module_entry = {
193 +  .node    = { NULL, NULL, NULL },
194 +  .name    = NULL,
195 +  .version = "$Revision$",
196 +  .handle  = NULL,
197 +  .modinit = module_init,
198 +  .modexit = module_exit,
199 +  .flags   = 0
200 + };

Diff Legend

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