IFGT Hazır kod Kanal ve Özel Loglama Modülü m_loggit.c

IFGENTR Konu Bilgileri

Konu Hakkında Merhaba, tarihinde Hazır_kodlar kategorisinde r4dx™ tarafından oluşturulan Kanal ve Özel Loglama Modülü m_loggit.c başlıklı konuyu okuyorsunuz. Bu konu şimdiye dek 38 kez görüntülenmiş, 0 yorum ve 0 tepki puanı almıştır...
Kategori Adı Hazır_kodlar
Konu Başlığı Kanal ve Özel Loglama Modülü m_loggit.c
Konbuyu başlatan r4dx™
Başlangıç tarihi
Cevaplar
Görüntüleme
İlk mesaj tepki puanı
Son Mesaj Yazan r4dx™

r4dx™

IFGT Developer
l 💙 IFGENTR
Katılım
12 Tem 2025
Mesajlar
634
Tepkime puanı
217
IFGT Puan
33
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.

Rich (BB code):
/*
 * ==================================================================
 * 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;
}