[ekg2-devel] Dalsze modyfikacje nagłówków
Michał Górny
mgorny.hejl w mailnull.com
Pią, 29 Lut 2008, 18:23:32 CET
TrochÄ porzÄ
dku z indentacjÄ
, jedno bitpole, dwie listy #define
zastÄ
pione enumem, uproszczenie w last_add().
--
Z powaĹźaniem,
MichaĹ GĂłrny
<http://mailnull.com/w?au=f6744c6f5e097cc9816a562802f331c2>
<xmpp:mgorny w jabster.pl>
-------------- następna część ---------
Index: commands.c
===================================================================
--- commands.c (wersja 3825)
+++ commands.c (kopia robocza)
@@ -3825,7 +3825,7 @@
&& xstrlen(format_find("last_list_timestamp"))>0)
xstrcpy(buf, "TOOLONG");
- if (show_sent && ll->type == 0 && !(ll->sent_time - config_time_deviation <= ll->time && ll->time <= ll->sent_time + config_time_deviation)) {
+ if (show_sent && !ll->type && !(ll->sent_time - config_time_deviation <= ll->time && ll->time <= ll->sent_time + config_time_deviation)) {
st = localtime(&ll->sent_time);
form = format_find((tm->tm_yday == now->tm_yday) ? "last_list_timestamp_today" : "last_list_timestamp");
if (!strftime(buf2, sizeof(buf2), form, st) && xstrlen(form)>0)
@@ -3834,11 +3834,7 @@
} else
time_str = xstrdup(buf);
- if (config_last & 4 && ll->type == 1)
- printq("last_list_out", time_str, format_user(session, ll->uid), ll->message);
- else
- printq("last_list_in", time_str, format_user(session, ll->uid), ll->message);
-
+ printq(config_last & 4 && ll->type ? "last_list_out" : "last_list_in", time_str, format_user(session, ll->uid), ll->message);
xfree(time_str);
}
}
Index: commands.h
===================================================================
--- commands.h (wersja 3825)
+++ commands.h (kopia robocza)
@@ -31,45 +31,41 @@
#define COMMAND(x) int x(const char *name, const char **params, session_t *session, const char *target, int quiet)
+typedef enum {
/* INFORMATIONAL FLAGS */
- /* command is binded by alias managment */
-#define COMMAND_ISALIAS 0x01
- /* command is binded by script mangament */
-#define COMMAND_ISSCRIPT 0x02
- /* [XXX] command uses resource, and resource should be passed */
-#define COMMAND_WITH_RESOURCE 0x04
+ COMMAND_ISALIAS = 0x01, /* command is binded by alias management */
+ COMMAND_ISSCRIPT = 0x02, /* command is binded by script management */
+ COMMAND_WITH_RESOURCE = 0x04, /* [XXX] command uses resource, and resource should be passed */
/* .... */
/* CONDITIONAL FLAGS */
- /* '!' in params means that arg must exist in par[..] (?) */
-#define COMMAND_ENABLEREQPARAMS 0x10
- /* when par[0] != NULL, than target = par[0] and than par list moves up (par++ ; par[0] == par[1] and so on */
-#define COMMAND_PARAMASTARGET 0x20
- /* session must be connected to execute that command */
-#define SESSION_MUSTBECONNECTED 0x40
- /* command must come from the same plugin as session (?) */
-#define SESSION_MUSTBELONG 0x80
- /* if session == NULL, we try session_current, if still NULL. we return -1... mh, i really don't know if this
- * flag is obsolete... but we do simillar thing in many places in code, so implemented. */
-#define SESSION_MUSTHAS 0x100
- /* session must exist and has private struct */
-#define SESSION_MUSTHASPRIVATE 0x200
- /* before executing handler, check if target (or params[0] if COMMAND_PARAMASTARGET set) is valid uid for current session, or we've got smb with this nickname
- * on userlist... (read: we check if get_uid(session, target) return smth, if not we print message) */
-#define COMMAND_TARGET_VALID_UID 0x400
+ COMMAND_ENABLEREQPARAMS = 0x10, /* '!' in params means that arg must exist in par[..] (?) */
+ COMMAND_PARAMASTARGET = 0x20, /* when par[0] != NULL, than target = par[0] and than par list moves up
+ (par++ ; par[0] == par[1] and so on */
+ SESSION_MUSTBECONNECTED = 0x40, /* session must be connected to execute that command */
+ SESSION_MUSTBELONG = 0x80, /* command must come from the same plugin as session (?) */
+ SESSION_MUSTHAS = 0x100, /* if session == NULL, we try session_current, if still NULL. we return -1...
+ mh, i really don't know if this flag is obsolete... but we do simillar thing
+ in many places in code, so implemented. */
+ SESSION_MUSTHASPRIVATE = 0x200, /* session must exist and has private struct */
+ COMMAND_TARGET_VALID_UID = 0x400 /* before executing handler, check if target (or params[0] if COMMAND_PARAMASTARGET
+ set) is valid uid for current session, or we've got smb with this nickname
+ on userlist... (read: we check if get_uid(session, target) return smth,
+ if not we print message) */
+} command_flags_t;
typedef COMMAND(command_func_t);
typedef struct {
- /* public: */
- const char *name;
- plugin_t *plugin;
+/* public: */
+ const char *name;
+ plugin_t *plugin;
- /* private: */
- char**params;
- command_func_t *function;
- int flags;
- char **possibilities;
+/* private: */
+ char **params;
+ command_func_t *function;
+ command_flags_t flags;
+ char **possibilities;
} command_t;
#ifndef EKG2_WIN32_NOFUNCTION
Index: windows.c
===================================================================
--- windows.c (wersja 3825)
+++ windows.c (kopia robocza)
@@ -596,7 +596,7 @@
if (w->id) {
if (w->target) {
- if (!w->floating)
+ if (!w->floating)
printq("window_list_query", itoa(w->id), w->target);
else
printq("window_list_floating", itoa(w->id), itoa(w->left), itoa(w->top), itoa(w->width), itoa(w->height), w->target);
Index: debug.h
===================================================================
--- debug.h (wersja 3825)
+++ debug.h (kopia robocza)
@@ -3,15 +3,17 @@
#ifndef __EKG_DEBUG_H
#define __EKG_DEBUG_H
-#define DEBUG_IO 1
-#define DEBUG_IORECV 2
-#define DEBUG_FUNCTION 3
-#define DEBUG_ERROR 4
-#define DEBUG_GGMISC 5 /* cause of a lot GG_DEBUG_MISC in libgadu we've got special formats for them... */
-#define DEBUG_WHITE 6
+typedef enum {
+ DEBUG_IO = 1,
+ DEBUG_IORECV,
+ DEBUG_FUNCTION,
+ DEBUG_ERROR,
+ DEBUG_GGMISC, /* cause of a lot GG_DEBUG_MISC in libgadu we've got special formats for them... */
+ DEBUG_WHITE
+} debug_level_t;
void debug(const char *format, ...);
-void debug_ext(int level, const char *format, ...);
+void debug_ext(debug_level_t level, const char *format, ...);
#define debug_io(args...) debug_ext(DEBUG_IO, args)
#define debug_iorecv(args...) debug_ext(DEBUG_IORECV, args)
Index: log.h
===================================================================
--- log.h (wersja 3825)
+++ log.h (kopia robocza)
@@ -30,11 +30,11 @@
#include "dynstuff.h"
struct last {
- int type; /* 0 - przychodząca, 1 - wychodząca */
- char *uid; /* od kogo, lub do kogo przy wysyłanych */
- time_t time; /* czas */
- time_t sent_time; /* czas wysłania wiadomości przychodzącej */
- char *message; /* wiadomość */
+ unsigned int type : 1; /* 0 - przychodząca, 1 - wychodząca */
+ char *uid; /* od kogo, lub do kogo przy wysyłanych */
+ time_t time; /* czas */
+ time_t sent_time; /* czas wysłania wiadomości przychodzącej */
+ char *message; /* wiadomość */
};
#ifndef EKG2_WIN32_NOFUNCTION
Index: stuff.c
===================================================================
--- stuff.c (wersja 3825)
+++ stuff.c (kopia robocza)
@@ -2280,7 +2280,7 @@
#endif
}
-void debug_ext(int level, const char *format, ...) {
+void debug_ext(debug_level_t level, const char *format, ...) {
va_list ap;
if (!config_debug) return;
Index: metacontacts.h
===================================================================
--- metacontacts.h (wersja 3825)
+++ metacontacts.h (kopia robocza)
@@ -22,9 +22,9 @@
#include "dynstuff.h"
typedef struct {
- char *name; /* uid or name */
- unsigned int prio; /* prio */
- char *s_uid; /* session uid */
+ char *name; /* uid or name */
+ unsigned int prio; /* prio */
+ char *s_uid; /* session uid */
} metacontact_item_t;
typedef struct {
Więcej informacji o liście dyskusyjnej ekg2-devel