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

Comparing ircd-hybrid/trunk/modules/m_dline.c (file contents):
Revision 1761 by michael, Fri Jan 18 19:21:39 2013 UTC vs.
Revision 2810 by michael, Sun Jan 12 18:30:44 2014 UTC

# Line 1 | Line 1
1   /*
2 < *  ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 < *  m_dline.c: Bans a user.
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) 2002-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 m_dline.c
23 > * \brief Includes required functions for processing the DLINE/UNDLINE command.
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
# Line 27 | Line 29
29   #include "channel.h"
30   #include "client.h"
31   #include "irc_string.h"
30 #include "sprintf_irc.h"
32   #include "conf.h"
33   #include "ircd.h"
34   #include "hostmask.h"
# Line 139 | Line 140 | static void
140   mo_dline(struct Client *client_p, struct Client *source_p,
141           int parc, char *parv[])
142   {
143 <  char def_reason[] = "<No reason specified>";
143 >  char def_reason[] = CONF_NOREASON;
144    char *dlhost = NULL, *reason = NULL;
145    char *target_server = NULL;
146    const char *creason;
# Line 155 | Line 156 | mo_dline(struct Client *client_p, struct
156  
157    if (!HasOFlag(source_p, OPER_FLAG_DLINE))
158    {
159 <    sendto_one(source_p, form_str(ERR_NOPRIVS),
160 <               me.name, source_p->name, "dline");
159 >    sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
160 >               source_p->name, "dline");
161      return;
162    }
163  
# Line 166 | Line 167 | mo_dline(struct Client *client_p, struct
167  
168    if (target_server != NULL)
169    {
170 <    if (HasID(source_p))
171 <    {
172 <      sendto_server(NULL, CAP_DLN|CAP_TS6, NOCAPS,
172 <                    ":%s DLINE %s %lu %s :%s",
173 <                    source_p->id, target_server, (unsigned long)tkline_time,
174 <                    dlhost, reason);
175 <      sendto_server(NULL, CAP_DLN, CAP_TS6,
176 <                    ":%s DLINE %s %lu %s :%s",
177 <                    source_p->name, target_server, (unsigned long)tkline_time,
178 <                    dlhost, reason);
179 <    }
180 <    else
181 <      sendto_server(NULL, CAP_DLN, NOCAPS,
182 <                    ":%s DLINE %s %lu %s :%s",
183 <                    source_p->name, target_server, (unsigned long)tkline_time,
184 <                    dlhost, reason);
170 >    sendto_match_servs(source_p, target_server, CAP_DLN, "DLINE %s %lu %s :%s",
171 >                       target_server, (unsigned long)tkline_time,
172 >                       dlhost, reason);
173  
174      /* Allow ON to apply local kline as well if it matches */
175      if (match(target_server, me.name))
# Line 193 | Line 181 | mo_dline(struct Client *client_p, struct
181  
182    if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST)
183    {
184 <    if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL)
184 >    if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL)
185        return;
186  
187      if (!MyConnect(target_p))
# Line 206 | Line 194 | mo_dline(struct Client *client_p, struct
194  
195      if (IsExemptKline(target_p))
196      {
197 <      sendto_one(source_p,
198 <                 ":%s NOTICE %s :%s is E-lined", me.name,
211 <                 source_p->name, target_p->name);
197 >      sendto_one(source_p, ":%s NOTICE %s :%s is E-lined",
198 >                 me.name, source_p->name, target_p->name);
199        return;
200      }
201  
# Line 240 | Line 227 | mo_dline(struct Client *client_p, struct
227    if ((conf = find_dline_conf(&daddr, aftype)) != NULL)
228    {
229      creason = conf->reason ? conf->reason : def_reason;
230 +
231      if (IsConfExemptKline(conf))
232 <      sendto_one(source_p,
233 <                 ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
246 <                 me.name, source_p->name, dlhost, conf->host, creason);
232 >      sendto_one(source_p, ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s",
233 >                 me.name, source_p->name, dlhost, conf->host, creason);
234      else
235 <      sendto_one(source_p,
236 <                 ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
250 <                 me.name, source_p->name, dlhost, conf->host, creason);
235 >      sendto_one(source_p, ":%s NOTICE %s :[%s] already D-lined by [%s] - %s",
236 >                 me.name, source_p->name, dlhost, conf->host, creason);
237      return;
238    }
239  
# Line 275 | Line 261 | static void
261   ms_dline(struct Client *client_p, struct Client *source_p,
262           int parc, char *parv[])
263   {
264 <  char def_reason[] = "<No reason specified>";
264 >  char def_reason[] = CONF_NOREASON;
265    char *dlhost, *reason;
266    const char *creason;
267    const struct Client *target_p = NULL;
# Line 304 | Line 290 | ms_dline(struct Client *client_p, struct
290    dlhost = parv[3];
291    reason = parv[4];
292  
293 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
293 >  if (HasFlag(source_p, FLAGS_SERVICE) ||
294 >      find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
295                                source_p->username, source_p->host,
296                                SHARED_DLINE))
297    {
# Line 312 | Line 299 | ms_dline(struct Client *client_p, struct
299        return;
300      if ((t = parse_netmask(dlhost, NULL, &bits)) == HM_HOST)
301      {
302 <      if ((target_p = find_chasing(client_p, source_p, dlhost, NULL)) == NULL)
302 >      if ((target_p = find_chasing(source_p, dlhost, NULL)) == NULL)
303          return;
304  
305        if (!MyConnect(target_p))
# Line 409 | Line 396 | mo_undline(struct Client *client_p, stru
396  
397    if (!HasOFlag(source_p, OPER_FLAG_UNDLINE))
398    {
399 <    sendto_one(source_p, form_str(ERR_NOPRIVS),
400 <               me.name, source_p->name, "undline");
399 >    sendto_one(source_p, form_str(ERR_NOPRIVS), me.name,
400 >               source_p->name, "undline");
401      return;
402    }
403  
# Line 440 | Line 427 | mo_undline(struct Client *client_p, stru
427  
428    if (remove_dline_match(addr))
429    {
430 <    sendto_one(source_p,
444 <               ":%s NOTICE %s :D-Line for [%s] is removed",
430 >    sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
431                 me.name, source_p->name, addr);
432      sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
433                           "%s has removed the D-Line for: [%s]",
# Line 468 | Line 454 | me_undline(struct Client *client_p, stru
454    if (!IsClient(source_p) || match(parv[1], me.name))
455      return;
456  
457 <  if (HasFlag(source_p, FLAGS_SERVICE) || find_matching_name_conf(CONF_ULINE,
458 <                                   source_p->servptr->name,
459 <                                   source_p->username, source_p->host,
460 <                                   SHARED_UNDLINE))
457 >  if (HasFlag(source_p, FLAGS_SERVICE) ||
458 >      find_matching_name_conf(CONF_ULINE, source_p->servptr->name,
459 >                              source_p->username, source_p->host,
460 >                              SHARED_UNDLINE))
461    {
462      if (remove_dline_match(addr))
463      {
464 <      sendto_one(source_p,
479 <                 ":%s NOTICE %s :D-Line for [%s] is removed",
464 >      sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed",
465                   me.name, source_p->name, addr);
466        sendto_realops_flags(UMODE_ALL, L_ALL, SEND_NOTICE,
467                             "%s has removed the D-Line for: [%s]",
468                             get_oper_name(source_p), addr);
469 <      ilog(LOG_TYPE_DLINE, "%s removed temporary D-Line for [%s]",
469 >      ilog(LOG_TYPE_DLINE, "%s removed D-Line for [%s]",
470             get_oper_name(source_p), addr);
471      }
472      else
# Line 504 | Line 489 | ms_undline(struct Client *client_p, stru
489    me_undline(client_p, source_p, parc, parv);
490   }
491  
492 < static struct Message dline_msgtab = {
492 > static struct Message dline_msgtab =
493 > {
494    "DLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
495 <   {m_unregistered, m_not_oper, ms_dline, m_ignore, mo_dline, m_ignore}
495 >  { m_unregistered, m_not_oper, ms_dline, m_ignore, mo_dline, m_ignore }
496   };
497  
498 < static struct Message undline_msgtab = {
498 > static struct Message undline_msgtab =
499 > {
500    "UNDLINE", 0, 0, 2, MAXPARA, MFLG_SLOW, 0,
501 <   {m_unregistered, m_not_oper, ms_undline, m_ignore, mo_undline, m_ignore}
501 >  { m_unregistered, m_not_oper, ms_undline, m_ignore, mo_undline, m_ignore }
502   };
503  
504   static void
# Line 532 | Line 519 | module_exit(void)
519    delete_capability("DLN");
520   }
521  
522 < struct module module_entry = {
522 > struct module module_entry =
523 > {
524    .node    = { NULL, NULL, NULL },
525    .name    = NULL,
526    .version = "$Revision$",

Diff Legend

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