From e2acf19d42b874eecd1b142a0e1192721fb295f5 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 2 Dec 2011 01:05:59 +0100 Subject: don't use hardcoded strings for plugin names --- plugins/checksum/checksum.c | 13 ++++++++----- plugins/exec/exec.c | 13 ++++++++----- plugins/upd/upd.c | 13 ++++++++----- plugins/winsys/winsys.cpp | 15 +++++++++------ 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/plugins/checksum/checksum.c b/plugins/checksum/checksum.c index 12fc0d93..103a80ca 100644 --- a/plugins/checksum/checksum.c +++ b/plugins/checksum/checksum.c @@ -42,6 +42,9 @@ #endif static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Checksum"; +static const char desc[] = "Calculate checksum for DCC file transfers"; +static const char version[] = "2.0"; static int config_fail; /* variable for config availability */ /* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */ @@ -324,9 +327,9 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Checksum"; - *plugin_desc = "Calculate checksum for DCC file transfers"; - *plugin_version = "2.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; init (); @@ -334,13 +337,13 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi xchat_hook_print (ph, "DCC RECV Complete", XCHAT_PRI_NORM, dccrecv_cb, NULL); xchat_hook_print (ph, "DCC Offer", XCHAT_PRI_NORM, dccoffer_cb, NULL); - xchat_print (ph, "Checksum plugin loaded\n"); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; } int xchat_plugin_deinit (void) { - xchat_print (ph, "Checksum plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/exec/exec.c b/plugins/exec/exec.c index b043ae83..fc8c8ec9 100644 --- a/plugins/exec/exec.c +++ b/plugins/exec/exec.c @@ -26,6 +26,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Exec"; +static const char desc[] = "Execute commands inside XChat"; +static const char version[] = "1.0"; static int run_command (char *word[], char *word_eol[], void *userdata) @@ -107,12 +110,12 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Exec"; - *plugin_desc = "Execute commands inside XChat"; - *plugin_version = "1.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; xchat_hook_command (ph, "EXEC", XCHAT_PRI_NORM, run_command, 0, 0); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ } @@ -120,6 +123,6 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi int xchat_plugin_deinit (void) { - xchat_print (ph, "Exec plugin unloaded\n"); + xchat_print (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/upd/upd.c b/plugins/upd/upd.c index 3eec06dc..7ab5edca 100644 --- a/plugins/upd/upd.c +++ b/plugins/upd/upd.c @@ -26,6 +26,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "Update Checker"; +static const char desc[] = "Check for XChat-WDK updates automatically"; +static const char version[] = "2.0"; /* we need this to store the result of the initial update check since the return value is preserved for XCHAT_EAT */ static int update_available; @@ -117,14 +120,14 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "Update Checker"; - *plugin_desc = "Plugin for checking for XChat-WDK updates"; - *plugin_version = "2.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); xchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); /* only start the timer if there's no update available during startup */ if (!update_available) @@ -140,6 +143,6 @@ int xchat_plugin_deinit (void) { xchat_command (ph, "MENU DEL \"Help/Check for updates\""); - xchat_print (ph, "Update Checker plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } diff --git a/plugins/winsys/winsys.cpp b/plugins/winsys/winsys.cpp index 2f68f75b..55a5ddaf 100644 --- a/plugins/winsys/winsys.cpp +++ b/plugins/winsys/winsys.cpp @@ -28,6 +28,9 @@ #include "xchat-plugin.h" static xchat_plugin *ph; /* plugin handle */ +static const char name[] = "WinSys"; +static const char desc[] = "Display info about your hardware and OS"; +static const char version[] = "1.0"; static int firstRun; static char *wmiOs; static char *wmiCpu; @@ -352,7 +355,7 @@ printInfo (char *word[], char *word_eol[], void *user_data) /* query WMI info only at the first time WinSys is called, then cache it to save time */ if (firstRun) { - xchat_printf (ph, "WinSys first execution, querying and caching WMI info...\n"); + xchat_printf (ph, "%s first execution, querying and caching WMI info...\n", name); wmiOs = getWmiInfo (0); wmiCpu = getWmiInfo (1); wmiVga = getWmiInfo (2); @@ -388,16 +391,16 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi { ph = plugin_handle; - *plugin_name = "WinSys"; - *plugin_desc = "Display info about your hardware and OS"; - *plugin_version = "1.0"; + *plugin_name = name; + *plugin_desc = desc; + *plugin_version = version; firstRun = 1; xchat_hook_command (ph, "WINSYS", XCHAT_PRI_NORM, printInfo, NULL, NULL); xchat_command (ph, "MENU -ietc\\system.png ADD \"Window/Display System Info\" \"WINSYS\""); - xchat_printf (ph, "%s plugin loaded\n", *plugin_name); + xchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ } @@ -407,6 +410,6 @@ int xchat_plugin_deinit (void) { xchat_command (ph, "MENU DEL \"Window/Display System Info\""); - xchat_print (ph, "WinSys plugin unloaded\n"); + xchat_printf (ph, "%s plugin unloaded\n", name); return 1; } -- cgit 1.4.1