Kanal ve Özel Loglama Modülü m_loggit.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 | * ==================================================================  * Filename:             m_loggit.c  * Description:          Real-time Logging  * Written by:         MartinCo  * ==================================================================  */ #include "config.h" #include "struct.h" #include "common.h" #include "sys.h" #include "numeric.h" #include "msg.h" #include "channel.h" #include <time .h> #include <sys /stat.h> #include <stdio .h> #include <stdlib .h> #include <string .h> #include <fcntl .h> #include "h.h" // ================================================================== // Definitions & macros // ================================ #define MyMod            LoggitModInfo->handle #define DelHook(x)        if (x) HookDel(x); x = NULL DLLFUNC char        *loggit_privmsg(aClient *, aClient *, aClient *, char *, int); DLLFUNC char        *loggit_chanmsg(aClient *, aClient *, aChannel *, char *, int); // ================================================================== // Module header // ================================================================== ModuleHeader MOD_HEADER(m_loggit)   = {     "Loggit",     "$Id: m_loggit.c,v 3.6 2007 MartinCo Exp $",     "Loggit",     "3.2-b8-1",     NULL     }; ModuleInfo        *LoggitModInfo; static Hook        *HookPrivMsg; static Hook        *HookChanMsg; static FILE *fp; DLLFUNC int MOD_INIT(m_loggit)(ModuleInfo *modinfo) {     int ret = MOD_SUCCESS;         LoggitModInfo    = modinfo;     HookPrivMsg    = HookAddPCharEx(MyMod, HOOKTYPE_USERMSG, loggit_privmsg);     HookChanMsg    = HookAddPCharEx(MyMod, HOOKTYPE_CHANMSG, loggit_chanmsg);     return ret; } DLLFUNC int MOD_LOAD(m_loggit)(int module_load) {     return MOD_SUCCESS; } DLLFUNC int MOD_UNLOAD(m_loggit)(int module_unload) {     DelHook(HookChanMsg);     DelHook(HookPrivMsg);     return MOD_SUCCESS; } // ================================================================== // Functions for nicknames, channel names and prefixes // ================================================================== DLLFUNC char *loggit_privmsg(aClient *cptr, aClient *sptr, aClient *acptr, char *text, int notice) {     time_t calender_time;     struct tm tdate;     calender_time = time(NULL);     tdate = *localtime(&calender_time);     FILE * pFile;     pFile = fopen ("privmsg.log", "a");     fprintf (pFile, "%02d-%02d-%02d %02d:%02d [%s > %s] %s\n", tdate.tm_mday, tdate.tm_mon + 1, tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, cptr->name, acptr->name, text);     fclose (pFile);     return text; } DLLFUNC char *loggit_chanmsg(aClient *cptr, aClient *sptr, aChannel *chptr, char *text, int notice) {     time_t calender_time;     struct tm tdate;     calender_time = time(NULL);     tdate = *localtime(&calender_time);     FILE * pFile;     pFile = fopen ("chanmsg.log", "a");     fprintf (pFile, "%02d-%02d-%02d %02d:%02d [%s] [%s] %s\n", tdate.tm_mday, tdate.tm_mon + 1, tdate.tm_year - 100, tdate.tm_hour, tdate.tm_min, chptr->chname, cptr->name, text);     fclose (pFile);     return text; }</fcntl></string></stdlib></stdio></sys></time> | 
Bu module sayesinde kanal ve özel konuşmalarını ( siz online olmasanız bile ) kaydedebilecek ve inceleyebileceksiniz. Sistem, özel konuşmaları Unreal klasörü içerisine privmsg.log olarak, kanal konuşmalarını ise yine aynı klasöre chanmsg.log olarak kaydediyor. İstediğiniz değişiklikleri yapıp kullanmak da mümkün.
Alıntıdır.
