~ubuntu-branches/debian/sid/ircd-hybrid/sid

« back to all changes in this revision

Viewing changes to modules/m_invite.c

  • Committer: Package Import Robot
  • Author(s): Dominic Hargreaves
  • Date: 2015-04-19 15:53:09 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20150419155309-06y59x2at2ax5ou3
Tags: 1:8.2.7+dfsg.1-1
* Remove Suggests: hybserv since it doesn't really work with
  ircd-hybrid 8 and above
* New upstream release
  - update debian/copyright with minor changes
  - update config files from new reference.conf
  - fixes DoS from localhost clients (Closes: #782859)
  - supports SSL certficate chaining (Closes: #769741)
* Debconf configuration script no longer ignores the result of
  upgrade questions (Closes: #779082)
* Don't display upgrade warnings on new installs (Closes: #782883)
* Add NEWS item about updated configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3
3
 *
4
 
 *  Copyright (c) 1997-2014 ircd-hybrid development team
 
4
 *  Copyright (c) 1997-2015 ircd-hybrid development team
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
21
21
 
22
22
/*! \file m_invite.c
23
23
 * \brief Includes required functions for processing the INVITE command.
24
 
 * \version $Id: m_invite.c 4564 2014-08-24 10:24:47Z michael $
 
24
 * \version $Id: m_invite.c 5346 2015-01-11 12:41:14Z michael $
25
25
 */
26
26
 
27
27
#include "stdinc.h"
35
35
#include "ircd.h"
36
36
#include "numeric.h"
37
37
#include "send.h"
38
 
#include "server.h"
39
38
#include "parse.h"
40
39
#include "modules.h"
41
40
#include "packet.h"
58
57
{
59
58
  struct Client *target_p = NULL;
60
59
  struct Channel *chptr = NULL;
61
 
  struct Membership *ms = NULL;
 
60
  struct Membership *member = NULL;
62
61
 
63
62
  if (parc < 2)
64
63
  {
65
 
    const dlink_node *ptr = NULL;
 
64
    const dlink_node *node = NULL;
66
65
 
67
 
    DLINK_FOREACH(ptr, source_p->localClient->invited.head)
 
66
    DLINK_FOREACH(node, source_p->connection->invited.head)
68
67
      sendto_one_numeric(source_p, &me, RPL_INVITELIST,
69
 
                         ((struct Channel *)ptr->data)->chname);
 
68
                         ((struct Channel *)node->data)->name);
 
69
 
70
70
    sendto_one_numeric(source_p, &me, RPL_ENDOFINVITELIST);
71
71
    return 0;
72
72
  }
92
92
    return 0;
93
93
  }
94
94
 
95
 
  if ((ms = find_channel_link(source_p, chptr)) == NULL)
 
95
  if ((member = find_channel_link(source_p, chptr)) == NULL)
96
96
  {
97
 
    sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->chname);
 
97
    sendto_one_numeric(source_p, &me, ERR_NOTONCHANNEL, chptr->name);
98
98
    return 0;
99
99
  }
100
100
 
101
 
  if (!has_member_flags(ms, CHFL_CHANOP))
 
101
  if (!has_member_flags(member, CHFL_CHANOP | CHFL_HALFOP))
102
102
  {
103
 
    sendto_one_numeric(source_p, &me, ERR_CHANOPRIVSNEEDED, chptr->chname);
 
103
    sendto_one_numeric(source_p, &me, ERR_CHANOPRIVSNEEDED, chptr->name);
104
104
    return 0;
105
105
  }
106
106
 
107
107
  if (IsMember(target_p, chptr))
108
108
  {
109
 
    sendto_one_numeric(source_p, &me, ERR_USERONCHANNEL, target_p->name, chptr->chname);
 
109
    sendto_one_numeric(source_p, &me, ERR_USERONCHANNEL, target_p->name, chptr->name);
110
110
    return 0;
111
111
  }
112
112
 
113
 
  if ((source_p->localClient->invite.last_attempt + ConfigChannel.invite_client_time) < CurrentTime)
114
 
    source_p->localClient->invite.count = 0;
 
113
  if ((source_p->connection->invite.last_attempt + ConfigChannel.invite_client_time) < CurrentTime)
 
114
    source_p->connection->invite.count = 0;
115
115
 
116
 
  if (source_p->localClient->invite.count > ConfigChannel.invite_client_count)
 
116
  if (source_p->connection->invite.count > ConfigChannel.invite_client_count)
117
117
  {
118
 
    sendto_one_numeric(source_p, &me, ERR_TOOMANYINVITE, chptr->chname, "user");
 
118
    sendto_one_numeric(source_p, &me, ERR_TOOMANYINVITE, chptr->name, "user");
119
119
    return 0;
120
120
  }
121
121
 
122
 
  source_p->localClient->invite.last_attempt = CurrentTime;
123
 
  source_p->localClient->invite.count++;
 
122
  source_p->connection->invite.last_attempt = CurrentTime;
 
123
  source_p->connection->invite.count++;
124
124
 
125
 
  sendto_one_numeric(source_p, &me, RPL_INVITING, target_p->name, chptr->chname);
 
125
  sendto_one_numeric(source_p, &me, RPL_INVITING, target_p->name, chptr->name);
126
126
 
127
127
  if (target_p->away[0])
128
128
    sendto_one_numeric(source_p, &me, RPL_AWAY, target_p->name, target_p->away);
132
132
    sendto_one(target_p, ":%s!%s@%s INVITE %s :%s",
133
133
               source_p->name, source_p->username,
134
134
               source_p->host,
135
 
               target_p->name, chptr->chname);
 
135
               target_p->name, chptr->name);
136
136
 
137
137
    if (chptr->mode.mode & MODE_INVITEONLY)
138
138
    {
139
 
      sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP,
140
 
                            "NOTICE @%s :%s is inviting %s to %s.",
141
 
                            chptr->chname, source_p->name,
142
 
                            target_p->name, chptr->chname);
 
139
      sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP | CHFL_HALFOP,
 
140
                            "NOTICE %%%s :%s is inviting %s to %s.",
 
141
                            chptr->name, source_p->name,
 
142
                            target_p->name, chptr->name);
143
143
 
144
144
      /* Add the invite if channel is +i */
145
145
      add_invite(chptr, target_p);
148
148
  else if (target_p->from != source_p->from)
149
149
    sendto_one(target_p, ":%s INVITE %s %s %lu",
150
150
               source_p->id, target_p->id,
151
 
               chptr->chname, (unsigned long)chptr->channelts);
 
151
               chptr->name, (unsigned long)chptr->creationtime);
152
152
  return 0;
153
153
}
154
154
 
184
184
    return 0;
185
185
 
186
186
  if (parc > 3 && IsDigit(*parv[3]))
187
 
    if (atoi(parv[3]) > chptr->channelts)
 
187
    if (atoi(parv[3]) > chptr->creationtime)
188
188
      return 0;
189
189
 
190
190
  if (MyConnect(target_p))
192
192
    sendto_one(target_p, ":%s!%s@%s INVITE %s :%s",
193
193
               source_p->name, source_p->username,
194
194
               source_p->host,
195
 
               target_p->name, chptr->chname);
 
195
               target_p->name, chptr->name);
196
196
 
197
197
    if (chptr->mode.mode & MODE_INVITEONLY)
198
198
    {
199
 
      sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP,
200
 
                            "NOTICE @%s :%s is inviting %s to %s.",
201
 
                            chptr->chname, source_p->name,
202
 
                            target_p->name, chptr->chname);
 
199
      sendto_channel_butone(NULL, &me, chptr, CHFL_CHANOP | CHFL_HALFOP,
 
200
                            "NOTICE %%%s :%s is inviting %s to %s.",
 
201
                            chptr->name, source_p->name,
 
202
                            target_p->name, chptr->name);
203
203
 
204
204
      /* Add the invite if channel is +i */
205
205
      add_invite(chptr, target_p);
208
208
  else if (target_p->from != source_p->from)
209
209
    sendto_one(target_p, ":%s INVITE %s %s %lu",
210
210
               source_p->id, target_p->id,
211
 
               chptr->chname, (unsigned long)chptr->channelts);
 
211
               chptr->name, (unsigned long)chptr->creationtime);
212
212
  return 0;
213
213
}
214
214
 
235
235
{
236
236
  .node    = { NULL, NULL, NULL },
237
237
  .name    = NULL,
238
 
  .version = "$Revision: 4564 $",
 
238
  .version = "$Revision: 5346 $",
239
239
  .handle  = NULL,
240
240
  .modinit = module_init,
241
241
  .modexit = module_exit,