1
0
mirror of https://github.com/moparisthebest/hexchat synced 2024-11-29 12:42:16 -05:00

don't use hardcoded strings for plugin names

This commit is contained in:
Berke Viktor 2011-12-02 01:05:59 +01:00
parent 0f9c35e214
commit e2acf19d42
4 changed files with 33 additions and 21 deletions

View File

@ -42,6 +42,9 @@
#endif #endif
static xchat_plugin *ph; /* plugin handle */ 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 */ static int config_fail; /* variable for config availability */
/* Use of OpenSSL SHA256 interface: http://adamlamers.com/?p=5 */ /* 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; ph = plugin_handle;
*plugin_name = "Checksum"; *plugin_name = name;
*plugin_desc = "Calculate checksum for DCC file transfers"; *plugin_desc = desc;
*plugin_version = "2.0"; *plugin_version = version;
init (); 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 RECV Complete", XCHAT_PRI_NORM, dccrecv_cb, NULL);
xchat_hook_print (ph, "DCC Offer", XCHAT_PRI_NORM, dccoffer_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; return 1;
} }
int int
xchat_plugin_deinit (void) xchat_plugin_deinit (void)
{ {
xchat_print (ph, "Checksum plugin unloaded\n"); xchat_printf (ph, "%s plugin unloaded\n", name);
return 1; return 1;
} }

View File

@ -26,6 +26,9 @@
#include "xchat-plugin.h" #include "xchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */ 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 static int
run_command (char *word[], char *word_eol[], void *userdata) 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; ph = plugin_handle;
*plugin_name = "Exec"; *plugin_name = name;
*plugin_desc = "Execute commands inside XChat"; *plugin_desc = desc;
*plugin_version = "1.0"; *plugin_version = version;
xchat_hook_command (ph, "EXEC", XCHAT_PRI_NORM, run_command, 0, 0); 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 */ return 1; /* return 1 for success */
} }
@ -120,6 +123,6 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
int int
xchat_plugin_deinit (void) xchat_plugin_deinit (void)
{ {
xchat_print (ph, "Exec plugin unloaded\n"); xchat_print (ph, "%s plugin unloaded\n", name);
return 1; return 1;
} }

View File

@ -26,6 +26,9 @@
#include "xchat-plugin.h" #include "xchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */ 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 */ /* 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; static int update_available;
@ -117,14 +120,14 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
{ {
ph = plugin_handle; ph = plugin_handle;
*plugin_name = "Update Checker"; *plugin_name = name;
*plugin_desc = "Plugin for checking for XChat-WDK updates"; *plugin_desc = desc;
*plugin_version = "2.0"; *plugin_version = version;
xchat_hook_command (ph, "UPDCHK", XCHAT_PRI_NORM, print_version, 0, 0); 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_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 */ /* only start the timer if there's no update available during startup */
if (!update_available) if (!update_available)
@ -140,6 +143,6 @@ int
xchat_plugin_deinit (void) xchat_plugin_deinit (void)
{ {
xchat_command (ph, "MENU DEL \"Help/Check for updates\""); 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; return 1;
} }

View File

@ -28,6 +28,9 @@
#include "xchat-plugin.h" #include "xchat-plugin.h"
static xchat_plugin *ph; /* plugin handle */ 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 int firstRun;
static char *wmiOs; static char *wmiOs;
static char *wmiCpu; 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 */ /* query WMI info only at the first time WinSys is called, then cache it to save time */
if (firstRun) 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); wmiOs = getWmiInfo (0);
wmiCpu = getWmiInfo (1); wmiCpu = getWmiInfo (1);
wmiVga = getWmiInfo (2); wmiVga = getWmiInfo (2);
@ -388,16 +391,16 @@ xchat_plugin_init (xchat_plugin *plugin_handle, char **plugin_name, char **plugi
{ {
ph = plugin_handle; ph = plugin_handle;
*plugin_name = "WinSys"; *plugin_name = name;
*plugin_desc = "Display info about your hardware and OS"; *plugin_desc = desc;
*plugin_version = "1.0"; *plugin_version = version;
firstRun = 1; firstRun = 1;
xchat_hook_command (ph, "WINSYS", XCHAT_PRI_NORM, printInfo, NULL, NULL); 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_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 */ return 1; /* return 1 for success */
} }
@ -407,6 +410,6 @@ int
xchat_plugin_deinit (void) xchat_plugin_deinit (void)
{ {
xchat_command (ph, "MENU DEL \"Window/Display System Info\""); 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; return 1;
} }