2004-08-04 22:23:10 +00:00
/* NeoStats - IRC Statistical Services
2006-01-26 15:33:47 +00:00
* * Copyright ( c ) 1999 - 2006 Adam Rutter , Justin Hammond , Mark Hetherington
2004-08-04 22:23:10 +00:00
* * 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 $
*/
2005-02-22 00:38:12 +00:00
# include "neostats.h"
2005-10-17 22:04:14 +00:00
# include "logserv.h"
# include "logmirc.h"
2004-08-04 22:23:10 +00:00
2005-10-17 22:04:14 +00:00
static char timebuf [ TIMEBUFSIZE ] ;
2005-10-14 21:49:36 +00:00
# define MIRCTIME "[%H:%M]"
static char * mirc_time ( void )
{
os_strftime ( timebuf , TIMEBUFSIZE , MIRCTIME , os_localtime ( & me . now ) ) ;
return timebuf ;
}
2004-08-04 22:23:10 +00:00
/* Session Start: Fri Jan 02 21:46:22 2004
* Session Ident : # neostats
* [ 21 : 46 ] * Now talking in # neostats
* [ 21 : 46 ] * Topic is ' < LuShes > I ' mmmm back ! ! ! ! [ NeoStats Support ] http : //www.neostats.net :: NeoStats-2.5.11 :: OPSB 2.0 Beta1 Released :: StupidServ 1.2 Released :: SecureServ 1.0 :: Happy Holidays from the entire NeoStats Team, including the trained monkey'
* [ 21 : 46 ] * Set by LuShes on Fri Jan 02 11 : 11 : 57
*/
# define MSTARTLOG "Session Start: %s\nSession Ident: %s\n%s * Now talking in %s\n%s * Topic is '%s'\n%s * Set by %s on %s\n"
2005-10-17 22:04:14 +00:00
void mirc_startlog ( ChannelLog * chandata , const CmdParams * cmdparams )
2005-10-14 21:49:36 +00:00
{
2005-10-17 22:04:14 +00:00
static char startlog [ BUFSIZE ] ;
static char timebuf2 [ TIMEBUFSIZE ] ;
static char timebuf3 [ TIMEBUFSIZE ] ;
2004-08-04 22:23:10 +00:00
2005-10-14 21:49:36 +00:00
os_strftime ( timebuf , TIMEBUFSIZE , " %a %b %d %H:%M:%S %Y " , os_localtime ( & me . now ) ) ;
os_strftime ( timebuf2 , TIMEBUFSIZE , " [%H:%M] " , os_localtime ( & me . now ) ) ;
2005-10-17 22:04:14 +00:00
os_strftime ( timebuf3 , TIMEBUFSIZE , " %a %b %d %H:%M:%S " , os_localtime ( & chandata - > c - > topictime ) ) ;
ircsnprintf ( startlog , BUFSIZE , MSTARTLOG , timebuf , chandata - > channame , timebuf2 , chandata - > channame , timebuf2 , chandata - > c - > topic [ 0 ] ! = ' 0 ' ? chandata - > c - > topic : " " , timebuf2 , chandata - > c - > topicowner [ 0 ] ! = ' 0 ' ? chandata - > c - > topicowner : " " , timebuf3 ) ;
os_fprintf ( chandata - > logfile , " %s " , startlog ) ;
2004-08-04 22:23:10 +00:00
}
/* [21:47] * Dirk-Digler has joined #neostats */
2005-10-14 21:49:36 +00:00
# define MJOINPROC "%s * %s( %s@%s ) has joined %s\n"
2004-08-04 22:23:10 +00:00
2005-10-14 21:49:36 +00:00
void mirc_joinproc ( ChannelLog * chandata , const CmdParams * cmdparams )
2004-08-04 22:23:10 +00:00
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MJOINPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > source - > user - > username , cmdparams - > source - > user - > vhost , cmdparams - > channel - > name ) ;
2004-08-04 22:23:10 +00:00
}
/* [22:07] * DigiGuy has left #neostats */
2005-10-14 21:49:36 +00:00
# define MPARTPROC "%s * %s( %s@%s ) has left %s( %s )\n"
2004-08-04 22:23:10 +00:00
2005-10-14 21:49:36 +00:00
void mirc_partproc ( ChannelLog * chandata , const CmdParams * cmdparams )
2004-08-04 22:23:10 +00:00
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MPARTPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > source - > user - > username , cmdparams - > source - > user - > vhost , cmdparams - > channel - > name , cmdparams - > param ) ;
2004-08-04 22:23:10 +00:00
}
/* [21:47] <Digi|Away> yes we are feeling nice today */
# define MMSGPROC "%s <%s> %s\n"
2005-10-14 21:49:36 +00:00
void mirc_msgproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MMSGPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > param ) ;
2004-08-04 22:23:10 +00:00
}
2005-10-14 21:49:36 +00:00
void mirc_noticeproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MMSGPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > param ) ;
2004-08-08 23:06:20 +00:00
}
/* [21:47] * Fish does a action for Digi|Away's log */
# define MACTPROC "%s * %s %s\n"
2005-10-14 21:49:36 +00:00
void mirc_ctcpaction ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MACTPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > param ) ;
2004-08-08 21:13:45 +00:00
}
2005-10-14 21:49:36 +00:00
/* [21:49] * DigiGuy has quit IRC( Quit: ha ) */
# define MQUITPROC "%s * %s has quit IRC( %s )\n"
2004-08-04 22:23:10 +00:00
2005-10-14 21:49:36 +00:00
void mirc_quitproc ( ChannelLog * chandata , const CmdParams * cmdparams )
2004-08-04 22:23:10 +00:00
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MQUITPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > param ) ;
2004-08-04 22:23:10 +00:00
}
/* [21:48] * Digi|Away changes topic to 'FREE PORN - DETAILS ' */
# define MTOPICPROC "%s * %s changes topic to '%s'\n"
2005-10-14 21:49:36 +00:00
void mirc_topicproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2008-02-26 05:34:57 +00:00
if ( cmdparams - > source ) {
ls_write_log ( chandata , MTOPICPROC , mirc_time ( ) , cmdparams - > source - > name , cmdparams - > param ) ;
} else {
ls_write_log ( chandata , MTOPICPROC , mirc_time ( ) , cmdparams - > channel - > topicowner , cmdparams - > param ) ;
}
2004-08-04 22:23:10 +00:00
}
2005-10-14 21:49:36 +00:00
/* [21:47] * Dirk-Digler was kicked by Fish( Fish ) */
# define MKICKPROC "%s * %s was kicked by %s( %s )\n"
2004-08-04 22:23:10 +00:00
2005-10-14 21:49:36 +00:00
void mirc_kickproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MKICKPROC , mirc_time ( ) , cmdparams - > target - > name , cmdparams - > source - > name , cmdparams - > param ) ;
2004-08-04 22:23:10 +00:00
}
/* [21:48] * Fish is now known as Fishy */
# define MNICKPROC "%s * %s is now known as %s\n"
2005-10-14 21:49:36 +00:00
void mirc_nickproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MNICKPROC , mirc_time ( ) , cmdparams - > param , cmdparams - > source - > name ) ;
2004-08-04 22:23:10 +00:00
}
/* [21:47] * Fish sets mode: +o Dirk-Digler */
# define MMODEPROC "%s * %s sets mode: %s\n"
2005-10-14 21:49:36 +00:00
void mirc_modeproc ( ChannelLog * chandata , const CmdParams * cmdparams )
{
2004-08-04 22:23:10 +00:00
char * modebuf ;
2005-10-14 21:49:36 +00:00
modebuf = joinbuf ( cmdparams - > av , cmdparams - > ac , 0 ) ;
2005-10-15 22:34:33 +00:00
ls_write_log ( chandata , MMODEPROC , mirc_time ( ) , cmdparams - > source - > name , modebuf ) ;
2005-10-14 21:49:36 +00:00
ns_free ( modebuf ) ;
2004-08-04 22:23:10 +00:00
}