ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.3/modules/m_ison.c
Revision: 1121
Committed: Sun Jan 9 11:03:03 2011 UTC (15 years, 6 months ago) by michael
Content type: text/x-csrc
File size: 3364 byte(s)
Log Message:
- removed all instances of STATIC_MODULES since we don't have
  static modules anymore
- removed m_mkpasswd module from contrib

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * m_ison.c: Provides a single line answer of whether a user is online.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 #include "stdinc.h"
26 #include "handlers.h"
27 #include "client.h"
28 #include "irc_string.h"
29 #include "sprintf_irc.h"
30 #include "ircd.h"
31 #include "numeric.h"
32 #include "send.h"
33 #include "msg.h"
34 #include "parse.h"
35 #include "modules.h"
36 #include "s_conf.h" /* ConfigFileEntry */
37
38 static void do_ison(struct Client *, struct Client *, int, char *[]);
39 static void m_ison(struct Client *, struct Client *, int, char *[]);
40
41 struct Message ison_msgtab = {
42 "ISON", 0, 0, 1, 1, MFLG_SLOW, 0,
43 {m_unregistered, m_ison, m_ignore, m_ignore, m_ison, m_ignore}
44 };
45
46 void
47 _modinit(void)
48 {
49 mod_add_cmd(&ison_msgtab);
50 }
51
52 void
53 _moddeinit(void)
54 {
55 mod_del_cmd(&ison_msgtab);
56 }
57
58 const char *_version = "$Revision$";
59
60
61 /*
62 * m_ison added by Darren Reed 13/8/91 to act as an efficent user indicator
63 * with respect to cpu/bandwidth used. Implemented for NOTIFY feature in
64 * clients. Designed to reduce number of whois requests. Can process
65 * nicknames in batches as long as the maximum buffer length.
66 *
67 * format:
68 * ISON :nicklist
69 */
70 static void
71 m_ison(struct Client *client_p, struct Client *source_p,
72 int parc, char *parv[])
73 {
74 do_ison(client_p, source_p, parc, parv);
75 }
76
77 static void
78 do_ison(struct Client *client_p, struct Client *source_p,
79 int parc, char *parv[])
80 {
81 struct Client *target_p = NULL;
82 char *nick;
83 char *p = NULL;
84 char *current_insert_point = NULL;
85 char buf[IRCD_BUFSIZE];
86 int len;
87 int i;
88 int done = 0;
89
90 len = ircsprintf(buf, form_str(RPL_ISON), me.name, parv[0]);
91 current_insert_point = buf + len;
92
93 /*
94 * rfc1459 is ambigious about how to handle ISON
95 * this should handle both interpretations.
96 */
97 for (i = 1; i < parc; i++)
98 {
99 for (nick = strtoken(&p, parv[i], " "); nick;
100 nick = strtoken(&p, NULL, " "))
101 {
102 if ((target_p = find_person(client_p, nick)))
103 {
104 len = strlen(target_p->name);
105
106 if ((current_insert_point + (len + 5)) < (buf + sizeof(buf)))
107 {
108 memcpy(current_insert_point, target_p->name, len);
109 current_insert_point += len;
110 *current_insert_point++ = ' ';
111 }
112 else
113 {
114 done = 1;
115 break;
116 }
117 }
118 }
119
120 if (done)
121 break;
122 }
123
124 /*
125 * current_insert_point--;
126 * Do NOT take out the trailing space, it breaks ircII
127 * --Rodder
128 */
129 *current_insert_point = '\0';
130
131 sendto_one(source_p, "%s", buf);
132 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision