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

« back to all changes in this revision

Viewing changes to modules/m_away.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_away.c
23
23
 * \brief Includes required functions for processing the AWAY command.
24
 
 * \version $Id: m_away.c 4564 2014-08-24 10:24:47Z michael $
 
24
 * \version $Id: m_away.c 5346 2015-01-11 12:41:14Z michael $
25
25
 */
26
26
 
27
27
#include "stdinc.h"
34
34
#include "modules.h"
35
35
#include "conf.h"
36
36
#include "server.h"
37
 
#include "packet.h"
38
37
#include "user.h"
39
38
 
40
39
 
52
51
static int
53
52
m_away(struct Client *source_p, int parc, char *parv[])
54
53
{
55
 
  if (!IsFloodDone(source_p))
56
 
    flood_endgrace(source_p);
 
54
  const char *const message = parv[1];
57
55
 
58
 
  if (parc < 2 || EmptyString(parv[1]))
 
56
  if (EmptyString(message))
59
57
  {
60
58
    /* Marking as not away */
61
59
    if (source_p->away[0])
63
61
      source_p->away[0] = '\0';
64
62
 
65
63
      /* We now send this only if they were away before --is */
66
 
      sendto_server(source_p, NOCAPS, NOCAPS, ":%s AWAY", source_p->id);
 
64
      sendto_server(source_p, 0, 0, ":%s AWAY", source_p->id);
67
65
      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%s@%s AWAY",
68
66
                                   source_p->name, source_p->username,
69
67
                                   source_p->host);
73
71
    return 0;
74
72
  }
75
73
 
76
 
  if ((source_p->localClient->away.last_attempt + ConfigGeneral.away_time) < CurrentTime)
77
 
    source_p->localClient->away.count = 0;
 
74
  if ((source_p->connection->away.last_attempt + ConfigGeneral.away_time) < CurrentTime)
 
75
    source_p->connection->away.count = 0;
78
76
 
79
 
  if (source_p->localClient->away.count > ConfigGeneral.away_count)
 
77
  if (source_p->connection->away.count > ConfigGeneral.away_count)
80
78
  {
81
79
    sendto_one_numeric(source_p, &me, ERR_TOOMANYAWAY);
82
80
    return 0;
83
81
  }
84
82
 
85
 
  source_p->localClient->away.last_attempt = CurrentTime;
86
 
  source_p->localClient->away.count++;
 
83
  source_p->connection->away.last_attempt = CurrentTime;
 
84
  source_p->connection->away.count++;
87
85
 
88
 
  strlcpy(source_p->away, parv[1], sizeof(source_p->away));
 
86
  strlcpy(source_p->away, message, sizeof(source_p->away));
89
87
 
90
88
  sendto_one_numeric(source_p, &me, RPL_NOWAWAY);
91
89
  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
92
90
                               source_p->name, source_p->username,
93
91
                               source_p->host, source_p->away);
94
 
  sendto_server(source_p, NOCAPS, NOCAPS, ":%s AWAY :%s",
 
92
  sendto_server(source_p, 0, 0, ":%s AWAY :%s",
95
93
                source_p->id, source_p->away);
96
94
  return 0;
97
95
}
110
108
static int
111
109
ms_away(struct Client *source_p, int parc, char *parv[])
112
110
{
113
 
  if (parc < 2 || EmptyString(parv[1]))
 
111
  const char *const message = parv[1];
 
112
 
 
113
  if (EmptyString(message))
114
114
  {
115
115
    /* Marking as not away */
116
116
    if (source_p->away[0])
118
118
      source_p->away[0] = '\0';
119
119
 
120
120
      /* We now send this only if they were away before --is */
121
 
      sendto_server(source_p, NOCAPS, NOCAPS, ":%s AWAY", source_p->id);
 
121
      sendto_server(source_p, 0, 0, ":%s AWAY", source_p->id);
122
122
      sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%s@%s AWAY",
123
123
                                   source_p->name, source_p->username,
124
124
                                   source_p->host);
127
127
    return 0;
128
128
  }
129
129
 
130
 
  strlcpy(source_p->away, parv[1], sizeof(source_p->away));
 
130
  strlcpy(source_p->away, message, sizeof(source_p->away));
131
131
 
132
132
  sendto_common_channels_local(source_p, 1, CAP_AWAY_NOTIFY, ":%s!%s@%s AWAY :%s",
133
133
                               source_p->name, source_p->username,
134
134
                               source_p->host, source_p->away);
135
 
  sendto_server(source_p, NOCAPS, NOCAPS, ":%s AWAY :%s",
 
135
  sendto_server(source_p, 0, 0, ":%s AWAY :%s",
136
136
                source_p->id, source_p->away);
137
137
  return 0;
138
138
}
161
161
{
162
162
  .node    = { NULL, NULL, NULL },
163
163
  .name    = NULL,
164
 
  .version = "$Revision: 4564 $",
 
164
  .version = "$Revision: 5346 $",
165
165
  .handle  = NULL,
166
166
  .modinit = module_init,
167
167
  .modexit = module_exit,