-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.c
More file actions
128 lines (119 loc) · 5.04 KB
/
events.c
File metadata and controls
128 lines (119 loc) · 5.04 KB
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
/* SeenServ - Nickname Seen Service - NeoStats Addon Module
** Copyright (c) 2003-2005 Justin Hammond, Mark Hetherington, Jeff Lang
**
** 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
**
** SeenServ CVS Identification
** $Id: events.c 47 2005-10-13 22:30:23Z Mark $
*/
#include "neostats.h" /* Required for bot support */
#include "seenserv.h"
static char tmpmsg[SS_MESSAGESIZE];
static char tmpmsg2[SS_MESSAGESIZE];
/*
* Signon Events
*/
int SeenSignon (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (ModIsUserExcluded(cmdparams->source))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Signon Event (%s)", cmdparams->source->name);
addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, NULL, SS_CONNECTED);
return NS_SUCCESS;
}
/*
* Quit Events
*/
int SeenQuit (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (ModIsUserExcluded(cmdparams->source))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Quit Event (%s (%s))", cmdparams->source->user->uservhostmask, cmdparams->param);
ircsnprintf(tmpmsg, SS_MESSAGESIZE, "(%s)", cmdparams->param);
addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_QUIT);
return NS_SUCCESS;
}
/*
* Kill Events
*/
int SeenKill (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (ModIsUserExcluded(cmdparams->target))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Kill Event (%s by %s (%s))", cmdparams->target->user->uservhostmask, cmdparams->source->name, cmdparams->param);
ircsnprintf(tmpmsg, SS_MESSAGESIZE, "by %s (%s)", cmdparams->source->name, cmdparams->param);
addseenentry(cmdparams->target->name, cmdparams->target->user->userhostmask, cmdparams->target->user->uservhostmask, tmpmsg, SS_KILLED);
return NS_SUCCESS;
}
/*
* Nick Events
*/
int SeenNickChange (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (ModIsUserExcluded(cmdparams->source))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Nick Change Event (%s to %s)", cmdparams->param, cmdparams->source->user->uservhostmask);
ircsnprintf(tmpmsg, SS_MESSAGESIZE, "%s!%s@%s", cmdparams->param, cmdparams->source->user->username, cmdparams->source->user->hostname);
ircsnprintf(tmpmsg2, SS_MESSAGESIZE, "%s!%s@%s", cmdparams->param, cmdparams->source->user->username, cmdparams->source->user->vhost);
addseenentry(cmdparams->param, tmpmsg, tmpmsg2, cmdparams->source->name, SS_NICKCHANGE);
return NS_SUCCESS;
}
/*
* Join Events
*/
int SeenJoinChan (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (is_hidden_chan(cmdparams->channel) || ModIsUserExcluded(cmdparams->source) || ModIsChannelExcluded(cmdparams->channel))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Join Event (%s %s)", cmdparams->source->user->uservhostmask, cmdparams->channel->name);
addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, cmdparams->channel->name, SS_JOIN);
return NS_SUCCESS;
}
/*
* Part Events
*/
int SeenPartChan (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (is_hidden_chan(cmdparams->channel) || ModIsUserExcluded(cmdparams->source) || ModIsChannelExcluded(cmdparams->channel))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Part Event (%s %s (%s))", cmdparams->source->user->uservhostmask, cmdparams->channel->name, cmdparams->param ? cmdparams->param : "");
if (cmdparams->param) {
ircsnprintf(tmpmsg, SS_MESSAGESIZE, "%s (%s)", cmdparams->channel->name, cmdparams->param);
} else {
strlcpy(tmpmsg, cmdparams->channel->name, SS_MESSAGESIZE);
}
addseenentry(cmdparams->source->name, cmdparams->source->user->userhostmask, cmdparams->source->user->uservhostmask, tmpmsg, SS_PART);
return NS_SUCCESS;
}
/*
* Kick Events
*/
int SeenKicked (const CmdParams *cmdparams)
{
SET_SEGV_LOCATION();
if (is_hidden_chan(cmdparams->channel) || ModIsUserExcluded(cmdparams->target) || ModIsChannelExcluded(cmdparams->channel))
return NS_SUCCESS;
dlog( DEBUG10, "Recording Kick Event (%s by %s from %s (%s))", cmdparams->target->user->uservhostmask, cmdparams->source->name, cmdparams->channel->name, cmdparams->param);
ircsnprintf(tmpmsg, SS_MESSAGESIZE, "%s by %s (%s)", cmdparams->channel->name, cmdparams->source->name, cmdparams->param);
addseenentry(cmdparams->target->name, cmdparams->target->user->userhostmask, cmdparams->target->user->uservhostmask, tmpmsg, SS_KICKED);
return NS_SUCCESS;
}