diff options
Diffstat (limited to 'src/fe-common')
-rw-r--r-- | src/fe-common/core/module-formats.h | 2 | ||||
-rw-r--r-- | src/fe-common/core/printformat.h | 25 | ||||
-rw-r--r-- | src/fe-common/core/printtext.h | 26 | ||||
-rw-r--r-- | src/fe-common/core/windows.c | 11 | ||||
-rw-r--r-- | src/fe-common/core/windows.h | 5 | ||||
-rw-r--r-- | src/fe-common/irc/dcc/module-formats.h | 4 | ||||
-rw-r--r-- | src/fe-common/irc/fe-ctcp.c | 6 | ||||
-rw-r--r-- | src/fe-common/irc/flood/module-formats.h | 2 | ||||
-rw-r--r-- | src/fe-common/irc/module-formats.h | 2 | ||||
-rw-r--r-- | src/fe-common/irc/notifylist/module-formats.h | 2 |
10 files changed, 54 insertions, 31 deletions
diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 8b9a6375..94392763 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -66,3 +66,5 @@ enum { extern FORMAT_REC fecommon_core_formats[]; #define MODULE_FORMATS fecommon_core_formats + +#include "printformat.h" diff --git a/src/fe-common/core/printformat.h b/src/fe-common/core/printformat.h new file mode 100644 index 00000000..e1dcf761 --- /dev/null +++ b/src/fe-common/core/printformat.h @@ -0,0 +1,25 @@ +/* printformat(...) = printformat_format(module_formats, ...) + + Could this be any harder? :) With GNU C compiler and C99 compilers, + use #define. With others use either inline functions if they are + supported or static functions if they are not.. + */ +#if defined (__GNUC__) && !defined (__STRICT_ANSI__) +/* GCC */ +# define printformat(server, channel, level, formatnum...) \ + printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum) +#elif defined (_ISOC99_SOURCE) +/* C99 */ +# define printformat(server, channel, level, formatnum, ...) \ + printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__) +#else +/* inline/static */ +static +#ifdef G_CAN_INLINE +inline +#endif +void printformat(void *server, const char *channel, int level, int formatnum, ...) +{ + printformat_format(MODULE_FORMATS, server, channel, level, formatnum); +} +#endif diff --git a/src/fe-common/core/printtext.h b/src/fe-common/core/printtext.h index 18f3246e..acd6a03e 100644 --- a/src/fe-common/core/printtext.h +++ b/src/fe-common/core/printtext.h @@ -24,32 +24,6 @@ typedef struct { #define PRINTFLAG_MIRC_COLOR 0x20 #define PRINTFLAG_INDENT 0x40 -/* printformat(...) = printformat_format(module_formats, ...) - - Could this be any harder? :) With GNU C compiler and C99 compilers, - use #define. With others use either inline functions if they are - supported or static functions if they are not.. - */ -#ifdef __GNUC__ -/* GCC */ -# define printformat(server, channel, level, formatnum...) \ - printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum) -#elif defined (_ISOC99_SOURCE) -/* C99 */ -# define printformat(server, channel, level, formatnum, ...) \ - printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__) -#else -/* inline/static */ -#ifdef G_CAN_INLINE -inline -#else -static -#endif -void printformat(void *server, const char *channel, int level, int formatnum, ...) -{ - printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum); -} -#endif void printformat_format(FORMAT_REC *formats, void *server, const char *channel, int level, int formatnum, ...); void printtext(void *server, const char *channel, int level, const char *str, ...); diff --git a/src/fe-common/core/windows.c b/src/fe-common/core/windows.c index 538b63ac..bcfaa38c 100644 --- a/src/fe-common/core/windows.c +++ b/src/fe-common/core/windows.c @@ -181,6 +181,17 @@ void window_set_level(WINDOW_REC *window, int level) signal_emit("window level changed", 1, window); } +/* return active item's name, or if none is active, window's name */ +char *window_get_active_name(WINDOW_REC *window) +{ + g_return_val_if_fail(window != NULL, NULL); + + if (window->active != NULL) + return window->active->name; + + return window->name; +} + WINDOW_REC *window_find_level(void *server, int level) { WINDOW_REC *match; diff --git a/src/fe-common/core/windows.h b/src/fe-common/core/windows.h index a3b06d86..2b13101b 100644 --- a/src/fe-common/core/windows.h +++ b/src/fe-common/core/windows.h @@ -58,8 +58,11 @@ void window_change_server(WINDOW_REC *window, void *server); void window_set_refnum(WINDOW_REC *window, int refnum); void window_set_name(WINDOW_REC *window, const char *name); - void window_set_level(WINDOW_REC *window, int level); + +/* return active item's name, or if none is active, window's name */ +char *window_get_active_name(WINDOW_REC *window); + WINDOW_REC *window_find_level(void *server, int level); WINDOW_REC *window_find_closest(void *server, const char *name, int level); WINDOW_REC *window_find_refnum(int refnum); diff --git a/src/fe-common/irc/dcc/module-formats.h b/src/fe-common/irc/dcc/module-formats.h index bc58035e..de01511f 100644 --- a/src/fe-common/irc/dcc/module-formats.h +++ b/src/fe-common/irc/dcc/module-formats.h @@ -32,8 +32,10 @@ enum { IRCTXT_DCC_CONNECT_ERROR, IRCTXT_DCC_CANT_CREATE, IRCTXT_DCC_REJECTED, - IRCTXT_DCC_CLOSE, + IRCTXT_DCC_CLOSE }; extern FORMAT_REC fecommon_irc_dcc_formats[]; #define MODULE_FORMATS fecommon_irc_dcc_formats + +#include "printformat.h" diff --git a/src/fe-common/irc/fe-ctcp.c b/src/fe-common/irc/fe-ctcp.c index a8d9a1c5..d06e1185 100644 --- a/src/fe-common/irc/fe-ctcp.c +++ b/src/fe-common/irc/fe-ctcp.c @@ -47,17 +47,17 @@ static void ctcp_print(const char *pre, const char *data, IRC_SERVER_REC *server static void ctcp_default_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) { - return ctcp_print("unknown CTCP", data, server, nick, addr, target); + ctcp_print("unknown CTCP", data, server, nick, addr, target); } static void ctcp_ping_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) { - return ctcp_print("CTCP PING", data, server, nick, addr, target); + ctcp_print("CTCP PING", data, server, nick, addr, target); } static void ctcp_version_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) { - return ctcp_print("CTCP VERSION", data, server, nick, addr, target); + ctcp_print("CTCP VERSION", data, server, nick, addr, target); } static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) diff --git a/src/fe-common/irc/flood/module-formats.h b/src/fe-common/irc/flood/module-formats.h index b435a752..8311b021 100644 --- a/src/fe-common/irc/flood/module-formats.h +++ b/src/fe-common/irc/flood/module-formats.h @@ -11,3 +11,5 @@ enum { extern FORMAT_REC fecommon_irc_flood_formats[]; #define MODULE_FORMATS fecommon_irc_flood_formats + +#include "printformat.h" diff --git a/src/fe-common/irc/module-formats.h b/src/fe-common/irc/module-formats.h index c7dc5bf8..d75ca9c4 100644 --- a/src/fe-common/irc/module-formats.h +++ b/src/fe-common/irc/module-formats.h @@ -162,3 +162,5 @@ enum { extern FORMAT_REC fecommon_irc_formats[]; #define MODULE_FORMATS fecommon_irc_formats + +#include "printformat.h" diff --git a/src/fe-common/irc/notifylist/module-formats.h b/src/fe-common/irc/notifylist/module-formats.h index 77b40cc2..f5f855dc 100644 --- a/src/fe-common/irc/notifylist/module-formats.h +++ b/src/fe-common/irc/notifylist/module-formats.h @@ -17,3 +17,5 @@ enum { extern FORMAT_REC fecommon_irc_notifylist_formats[]; #define MODULE_FORMATS fecommon_irc_notifylist_formats + +#include "printformat.h" |