forked from florian-sander/stats.mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
egg_bindings.c
184 lines (156 loc) · 4.04 KB
/
egg_bindings.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/*
* Copyright (C) 2000,2001 Florian Sander
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
static int eggbnd_pubm(char *nick, char *uhost, char *hand, char *channel, char *rest)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan)
sensor_text(chan, nick, rest);
return 0;
}
static int eggbnd_topc(char *nick, char *uhost, char *hand, char *channel, char *topic)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan)
sensor_topic(nick, chan, topic);
return 0;
}
static int eggbnd_action(char *nick, char *uhost, char *hand, char *channel,
char *key, char *rest)
{
struct stats_chan *chan;
if (strchr(CHANMETA, channel[0])) {
chan = schan_find(channel);
if (chan)
sensor_action(nick, chan, rest);
}
return 0;
}
static int eggbnd_kick(char *nick, char *uhost, char *hand, char *channel,
char *victim, char *reason)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan) {
sensor_kick(nick, chan, victim, reason);
schan_leave(chan, victim);
}
return 0;
}
static int eggbnd_mode(char *nick, char *uhost, char *hand, char *channel,
char *mode, char *victim)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan)
sensor_mode(nick, chan, mode, victim);
return 0;
}
static int eggbnd_nick(char *nick, char *uhost, char *hand, char *channel,
char *newnick)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan) {
sensor_nick(nick, chan, newnick);
schan_members_rename(&chan->members, nick, newnick);
}
return 0;
}
static int eggbnd_join(char *nick, char *uhost, char *hand, char *channel)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (!chan)
chan = schan_add(channel);
schan_join(chan, nick, uhost, *hand != '*' ? hand : NULL);
sensor_join(nick, uhost, chan);
return 0;
}
static int eggbnd_part(char *nick, char *uhost, char *hand, char *channel)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan) {
sensor_left(nick, chan, SL_PART);
schan_leave(chan, nick);
}
return 0;
}
static int eggbnd_sign(char *nick, char *uhost, char *hand, char *channel,
char *reason)
{
struct stats_chan *chan;
chan = schan_find(channel);
if (chan) {
sensor_left(nick, chan, SL_QUIT);
schan_leave(chan, nick);
}
return 0;
}
static void eggbnd_minutely()
{
sensor_minutely();
egg_check_chan_desynch();
}
static cmd_t stats_pubm[] =
{
{"*", "", (IntFunc) eggbnd_pubm, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_topc[] =
{
{"*", "", (IntFunc) eggbnd_topc, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_ctcp[] =
{
{"ACTION", "", (IntFunc) eggbnd_action, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_kick[] =
{
{"*", "", (IntFunc) eggbnd_kick, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_mode[] =
{
{"*", "", (IntFunc) eggbnd_mode, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_nick[] =
{
{"*", "", (IntFunc) eggbnd_nick, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_join[] =
{
{"*", "", (IntFunc) eggbnd_join, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_part[] =
{
{"*", "", (IntFunc) eggbnd_part, "stat"},
{0, 0, 0, 0}
};
static cmd_t stats_sign[] =
{
{"*", "", (IntFunc) eggbnd_sign, "stat"},
{0, 0, 0, 0}
};