-
Notifications
You must be signed in to change notification settings - Fork 1
/
logxchat.c
139 lines (111 loc) · 4.98 KB
/
logxchat.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
/* 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: logxchat.c 132 2008-02-26 05:34:57Z Fish $
*/
#include "neostats.h"
#include "logserv.h"
#include "logxchat.h"
/* XCHAT FORMAT LOGGING BELOW */
static char timebuf[TIMEBUFSIZE];
#define XCHATTIME "%b %d %H:%M:%S"
static char *xchat_time( void )
{
os_strftime( timebuf, TIMEBUFSIZE, XCHATTIME, os_localtime( &me.now ) );
return timebuf;
}
/* **** BEGIN LOGGING AT Fri Jan 2 17:25:15 2004
* \n
*/
#define XSTARTLOG "**** BEGIN LOGGING AT %s\n\n"
void xchat_startlog( ChannelLog *chandata, const CmdParams *cmdparams )
{
static char startlog[BUFSIZE];
static char tmbuf[TIMEBUFSIZE];
os_strftime( tmbuf, TIMEBUFSIZE, "%a %b %d %H:%M:%S %Y", os_localtime( &me.now ) );
ircsnprintf( startlog, BUFSIZE, XSTARTLOG, tmbuf );
os_fprintf( chandata->logfile, "%s", startlog );
}
/* Jan 02 17:27:10 --> Dirk-Digler( fish@Dirk-Digler.Users.irc-chat.net ) has joined #neostats */
#define XJOINFMT "%s -->\t%s( %s@%s ) has joined %s\n"
void xchat_joinproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XJOINFMT, xchat_time(), cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->channel->name );
}
/* Jan 02 17:56:52 <-- DigiGuy( ~b.dole@Oper.irc-chat.net ) has left #neostats( part )*/
#define XPARTPROC "%s <--\t%s( %s@%s ) has left %s( %s )\n"
void xchat_partproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XPARTPROC, xchat_time(), cmdparams->source->name, cmdparams->source->user->username, cmdparams->source->user->vhost, cmdparams->channel->name, cmdparams->param );
}
/* Jan 02 17:25:43 <SecureServ> Akilling jojo!~jojo@pD9E60152.dip.t-dialin.net for Virus IRCORK */
#define XMSGFMT "%s <%s>\t%s\n"
void xchat_msgproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XMSGFMT, xchat_time(), cmdparams->source->name, cmdparams->param );
}
void xchat_noticeproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XMSGFMT, xchat_time(), cmdparams->source->name, cmdparams->param );
}
/* Action:
* Jan 02 17:28:52 * Fish-Away sighs */
#define XACTFMT "%s *\t%s %s\n"
void xchat_ctcpaction( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XACTFMT, xchat_time(), cmdparams->source->name, cmdparams->param );
}
/* Jan 02 17:47:26 <-- Dirk-Digler has quit( Killed( Fish( get lost ) ) ) */
#define XQUITFMT "%s <--\t%s has quit( %s )\n"
void xchat_quitproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XQUITFMT, xchat_time(), cmdparams->source->name, cmdparams->param );
}
/* Jan 02 17:48:12 --- Digi|Away has changed the topic to: FREE PORN - DETAILS INSIDE */
#define XTOPICPROC "%s ---\t%s has changed the topic to: %s\n"
void xchat_topicproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
if (cmdparams->source) {
ls_write_log( chandata, XTOPICPROC, xchat_time(), cmdparams->source->name, cmdparams->param );
} else {
ls_write_log( chandata, XTOPICPROC, xchat_time(), cmdparams->channel->topicowner, cmdparams->param );
}
}
/* Jan 02 17:27:10 <-- Fish-Away has kicked Dirk-Digler from #neostats( ha ) */
#define XKICKPROC "%s <--\t%s has kicked %s from %s( %s )\n"
void xchat_kickproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XKICKPROC, xchat_time(), cmdparams->source->name, cmdparams->target->name, cmdparams->channel->name, cmdparams->param );
}
/* Jan 02 17:50:32 --- DigiGuy is now known as Bob */
#define XNICKPROC "%s ---\t%s is now known as %s\n"
void xchat_nickproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
ls_write_log( chandata, XNICKPROC, xchat_time(), cmdparams->param, cmdparams->source->name );
}
/* Jan 02 17:27:10 --- SuperSexSquirrel sets modes [#NeoStats +v Dirk-Digler] */
#define XMODEPROC "%s ---\t%s sets modes[%s %s]\n"
void xchat_modeproc( ChannelLog *chandata, const CmdParams *cmdparams )
{
char *modebuf;
modebuf = joinbuf( cmdparams->av, cmdparams->ac, 0 );
ls_write_log( chandata, XMODEPROC, xchat_time(), cmdparams->source->name, chandata->channame, modebuf );
ns_free( modebuf );
}