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 34 by lusky, Sun Oct 2 21:05:51 2005 UTC vs.
Revision 968 by michael, Sun Aug 2 18:11:54 2009 UTC

# Line 41 | Line 41
41   #include "modules.h"
42   #include "s_user.h"
43  
44 < static void m_list(struct Client *, struct Client *, int, char **);
45 < static void ms_list(struct Client *, struct Client *, int, char **);
46 < static void mo_list(struct Client *, struct Client *, int, char **);
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, ms_list, m_ignore, mo_list, m_ignore}
49 >  {m_unregistered, m_list, m_ignore, m_ignore, mo_list, m_ignore}
50   };
51  
52   #ifndef STATIC_MODULES
# Line 88 | Line 87 | do_list(struct Client *source_p, int par
87    struct ListTask *lt;
88    int no_masked_channels;
89  
90 <  if (MyConnect(source_p))
90 >  if (source_p->localClient->list_task != NULL)
91    {
92 <    if (source_p->localClient->list_task != NULL)
93 <    {
94 <      free_list_task(source_p->localClient->list_task, source_p);
96 <      sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
97 <      return;
98 <    }
92 >    free_list_task(source_p->localClient->list_task, source_p);
93 >    sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name);
94 >    return;
95    }
96  
97 <  lt = (struct ListTask *) MyMalloc(sizeof(struct ListTask));
97 >  lt = MyMalloc(sizeof(struct ListTask));
98    lt->users_max = UINT_MAX;
99    lt->created_max = UINT_MAX;
100    lt->topicts_max = UINT_MAX;
101 <  if (MyConnect(source_p))
102 <    source_p->localClient->list_task = lt;
101 >  source_p->localClient->list_task = lt;
102 >
103    no_masked_channels = 1;
104  
105    if (parc > 1)
106    {
107 <    char *opt, *save;
107 >    char *opt, *save = NULL;
108      dlink_list *list;
109      int i, errors = 0;
110  
# Line 188 | Line 184 | do_list(struct Client *source_p, int par
184      {
185        free_list_task(lt, source_p);
186        sendto_one(source_p, form_str(ERR_LISTSYNTAX),
187 <                 MyConnect(source_p) ? me.name : ID(&me),
192 <                 MyConnect(source_p) ? source_p->name : ID(source_p));
187 >                 me.name, source_p->name);
188        return;
189      }
190    }
191  
192  
193 <  if (MyConnect(source_p))
194 <    dlinkAdd(source_p, make_dlink_node(), &listing_client_list);
193 >  dlinkAdd(source_p, make_dlink_node(), &listing_client_list);
194 >
195    sendto_one(source_p, form_str(RPL_LISTSTART),
196 <             MyConnect(source_p) ? me.name : ID(&me),
202 <             MyConnect(source_p) ? source_p->name : ID(source_p));
196 >             me.name, source_p->name);
197    safe_list_channels(source_p, lt, no_masked_channels &&
198 <                     lt->show_mask.head != NULL, !MyConnect(source_p));
198 >                     lt->show_mask.head != NULL);
199   }
200  
201   /*
# Line 215 | Line 209 | m_list(struct Client *client_p, struct C
209   {
210    static time_t last_used = 0;
211  
218  /* If not a LazyLink connection, see if its still paced */
219  /* If we're forwarding this to uplinks.. it should be paced due to the
220   * traffic involved in /list.. -- fl_ */
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    }
226  else
227    last_used = CurrentTime;
217  
218 <  /* If its a LazyLinks connection, let uplink handle the list */
230 <  if (uplink && IsCapable(uplink, CAP_LL))
231 <  {
232 <    if (parc < 2)
233 <      sendto_one(uplink, ":%s LIST", source_p->name);
234 <    else
235 <      sendto_one(uplink, ":%s LIST %s", source_p->name, parv[1]);
236 <    return;
237 <  }
218 >  last_used = CurrentTime;
219  
220    do_list(source_p, parc, parv);
221   }
# Line 248 | Line 229 | static void
229   mo_list(struct Client *client_p, struct Client *source_p,
230          int parc, char *parv[])
231   {
251  /* If its a LazyLinks connection, let uplink handle the list
252   * even for opers!
253   */
254
255  if (uplink && IsCapable(uplink, CAP_LL))
256  {
257    if (parc < 2)
258      sendto_one(uplink, ":%s LIST", source_p->name);
259    else
260      sendto_one(uplink, ":%s LIST %s", source_p->name, parv[1]);
261    return;
262  }
263
232    do_list(source_p, parc, parv);
233   }
266
267 /*
268 ** ms_list
269 **      parv[0] = sender prefix
270 **      parv[1] = channel
271 */
272 static void
273 ms_list(struct Client *client_p, struct Client *source_p,
274        int parc, char *parv[])
275 {
276  /* Only allow remote list if LazyLink request */
277  if (ServerInfo.hub)
278  {
279    if (!IsCapable(client_p->from, CAP_LL) && !MyConnect(source_p))
280      return;
281
282    do_list(source_p, parc, parv);
283  }
284 }

Diff Legend

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