-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogeggdrop.c
More file actions
138 lines (112 loc) · 5.25 KB
/
logeggdrop.c
File metadata and controls
138 lines (112 loc) · 5.25 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
129
130
131
132
133
134
135
136
137
/* NeoStats - IRC Statistical Services
** Copyright (c) 1999-2006 Adam Rutter, Justin Hammond, Mark Hetherington
** http://www.neostats.net/
**
** 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
**
** NeoStats CVS Identification
** $Id: logeggdrop.c 132 2008-02-26 05:34:57Z Fish $
*/
#include "neostats.h"
#include "logserv.h"
#include "logeggdrop.h"
static char timebuf[TIMEBUFSIZE];
#define EGGTIME "[%H:%M]"
static char *egg_time( void )
{
os_strftime( timebuf, TIMEBUFSIZE, EGGTIME, os_localtime( &me.now ) );
return timebuf;
}
/* [00:00] --- Fri Jan 2 2004 */
/* this usually goes at the end of a logfile. Hrm */
void egg_startlog( ChannelLog *chandata, const CmdParams *cmdparams )
{
static char startlog[BUFSIZE];
os_strftime( startlog, BUFSIZE, "[%H:%M] --- %a %b %d %Y\n", os_localtime( &me.now ) );
os_fprintf( chandata->logfile, "%s", startlog );
}
/* [22:02] Fish( ~Fish@Server-Admin.irc-chat.net ) joined #neostats. */
#define EJOINPROC "%s %s( %s@%s ) joined %s.\n"
void egg_joinproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EJOINPROC, egg_time(), cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->channel->name );
}
/* [22:02] Fish( ~Fish@Server-Admin.irc-chat.net ) left #neostats( ha ). */
#define EPARTPROC "%s %s( %s@%s ) left %s( %s ).\n"
void egg_partproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EPARTPROC, egg_time(), cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->channel->name, cmdparams->param );
}
/* [22:04] <Fish> I think that is it */
#define EMSGPROC "%s <%s> %s\n"
void egg_msgproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EMSGPROC, egg_time(), cmdparams->source->name, cmdparams->param );
}
void egg_noticeproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EMSGPROC, egg_time(), cmdparams->source->name, cmdparams->param );
}
/* [22:04] Action: Fish waits for the eggdrop to flush its logs now */
#define EACTPROC "%s Action: %s %s\n"
void egg_ctcpaction( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EACTPROC, egg_time(), cmdparams->source->name, cmdparams->param );
}
/* [22:03] Fishwaldo( ~Fish@3cbc6b2b.22d996b6.singnet.com.sg ) left irc: Client closed */
#define EQUITPROC "%s %s( %s@%s ) left irc: %s\n"
void egg_quitproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EQUITPROC, egg_time(), cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->param );
}
/* [22:02] Topic changed on #neostats by Fish!~Fish@Server-Admin.irc-chat.net: <LuShes> I'mmmm back!!!! [NeoStats Support] http://www.neostats.net */
#define ETOPICPROC "%s Topic changed on %s by %s!%s@%s: %s\n"
#define ENOUSERTOPICPROC "%s Topic changed on %s by %s: %s\n"
void egg_topicproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
if( cmdparams->source)
ls_write_log( chandata, ETOPICPROC, egg_time(), cmdparams->channel->name, cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->param );
else
ls_write_log( chandata, ENOUSERTOPICPROC, egg_time(), cmdparams->channel->name, cmdparams->channel->topicowner, cmdparams->param );
}
/* [22:02] Fish kicked from #neostats by Fish: Fish */
#define EKICKPROC "%s %s kicked from %s by %s: %s\n"
void egg_kickproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, EKICKPROC, egg_time(), cmdparams->target->name, cmdparams->channel->name, cmdparams->source->name, cmdparams->param );
}
/* [22:02] #NeoStats: mode change '+oa Fish Fish' by SuperSexSquirrel!super@supersexsquirrel.org */
#define EMODEPROC "%s %s: mode change '%s' by %s!%s@%s\n"
#define ENOUSERMODEPROC "%s %s: mode change '%s' by %s\n"
void egg_modeproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
char *modebuf;
modebuf = joinbuf( cmdparams->av, cmdparams->ac, 0 );
if( cmdparams->source->user )
{
ls_write_log( chandata, EMODEPROC, egg_time(), cmdparams->channel->name, modebuf, cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost );
}
else
{
ls_write_log( chandata, ENOUSERMODEPROC, egg_time(), cmdparams->channel->name, modebuf, cmdparams->source->name );
}
}
/* [22:02] Nick change: Fish -> haha */
#define ENICKPROC "%s Nick change: %s -> %s\n"
void egg_nickproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, ENICKPROC, egg_time(), cmdparams->param, cmdparams->source->name );
}