ekg2
plugins/logs/main.h
Idź do dokumentacji tego pliku.
00001 /* $Id$ */
00002 
00003 /*
00004  *  (C) Copyright 2003-2004 Leszek Krupiński <leafnode@wafel.com>
00005  *                     2005 Adam Mikuta <adamm@ekg2.org>
00006  *
00007  *  This program is free software; you can redistribute it and/or modify
00008  *  it under the terms of the GNU Lesser General Public License Version
00009  *  2.1 as published by the Free Software Foundation.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU Lesser General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU Lesser General Public
00017  *  License along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifndef __logs_h__
00022 #define __logs_h__
00023 
00024 #include "ekg2-config.h"
00025 #include <stdio.h>
00026 #include <ekg/sessions.h>
00027 #include <ekg/plugins.h>
00028 #include <ekg/protocol.h>
00029 
00030 typedef struct {
00031         int   logformat; 
00032                         /* 19:55:24 <@zdzichuBG> wtedy trzeba by jescze jakis callback na zmiane zmiennej logs_format 
00033                          * callback zmiennych sesyjnych w ekg2 niet. jest cos takiego.
00034                          */
00035         char *path;     /* path don't free it ! .... */
00036         FILE *file;     /* file don't close it! it will be closed at unloading plugin. */
00037 } log_window_t;
00038 
00039 typedef struct {
00040         char *session;  /* session name */
00041         char *uid;      /* uid of user */
00042         time_t t;       /* time when we create (lw->path || just lw) */
00043         log_window_t *lw;
00044 } logs_log_t;
00045 
00046 /* log ff types... */
00047 typedef enum {
00048         LOG_FORMAT_NONE = 0,
00049         LOG_FORMAT_SIMPLE,
00050         LOG_FORMAT_XML,
00051         LOG_FORMAT_IRSSI,
00052         LOG_FORMAT_RAW, 
00053 } log_format_t;
00054 
00055         /* irssi style info messages */
00056 #define IRSSI_LOG_EKG2_OPENED   "--- Log opened %a %b %d %H:%M:%S %Y"   /* defaultowy log_open_string irssi , jak cos to dodac zmienna... */
00057 #define IRSSI_LOG_EKG2_CLOSED   "--- Log closed %a %b %d %H:%M:%S %Y"   /* defaultowy log_close_string irssi, jak cos to dodac zmienna... */
00058 #define IRSSI_LOG_DAY_CHANGED   "--- Day changed %a %b %d %Y"           /* defaultowy log_day_changed irssi , jak cos to dodac zmienna... */
00059 
00060 static char *logs_prepare_path(session_t *session, const char *logs_path, const char *uid, time_t sent);
00061 static const char *prepare_timestamp_format(const char *format, time_t t);
00062 
00063 static logs_log_t *logs_log_find(const char *session, const char *uid, int create);
00064 static logs_log_t *logs_log_new(logs_log_t *l, const char *session, const char *uid);
00065 
00066 static FILE *logs_open_file(char *path, int ff);
00067 
00068 static void logs_simple(FILE *file, const char *session, const char *uid, const char *text, time_t sent, msgclass_t class, const char *status);
00069 static void logs_xml    (FILE *file, const char *session, const char *uid, const char *text, time_t sent, msgclass_t class);
00070 static void logs_irssi(FILE *file, const char *session, const char *uid, const char *text, time_t sent, msgclass_t class);
00071 #if 0 /* never started? */
00072 static void logs_gaim();
00073 #endif
00074 
00075 static list_t log_logs = NULL; 
00076 
00077 static int config_logs_log;
00078 static int config_logs_log_raw;
00079 static int config_logs_log_ignored;
00080 static int config_logs_log_status;
00081 static int config_logs_remind_number = 0;
00082 static int config_logs_max_files = 7;
00083 static char *config_logs_path;
00084 static char *config_logs_timestamp;
00085 
00086 #endif
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje