mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-12 16:50:19 +00:00
Rebranding for the rest of plugin*
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
#define g_ascii_strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
static xchat_plugin *ph; /* plugin handle */
|
||||
static hexchat_plugin *ph; /* plugin handle */
|
||||
static GSList *timer_list = NULL;
|
||||
|
||||
#define STATIC
|
||||
@@ -17,8 +17,8 @@ static GSList *timer_list = NULL;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
xchat_hook *hook;
|
||||
xchat_context *context;
|
||||
hexchat_hook *hook;
|
||||
hexchat_context *context;
|
||||
char *command;
|
||||
int ref;
|
||||
int repeat;
|
||||
@@ -31,7 +31,7 @@ timer_del (timer *tim)
|
||||
{
|
||||
timer_list = g_slist_remove (timer_list, tim);
|
||||
free (tim->command);
|
||||
xchat_unhook (ph, tim->hook);
|
||||
hexchat_unhook (ph, tim->hook);
|
||||
free (tim);
|
||||
}
|
||||
|
||||
@@ -49,21 +49,21 @@ timer_del_ref (int ref, int quiet)
|
||||
{
|
||||
timer_del (tim);
|
||||
if (!quiet)
|
||||
xchat_printf (ph, "Timer %d deleted.\n", ref);
|
||||
hexchat_printf (ph, "Timer %d deleted.\n", ref);
|
||||
return;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
if (!quiet)
|
||||
xchat_print (ph, "No such ref number found.\n");
|
||||
hexchat_print (ph, "No such ref number found.\n");
|
||||
}
|
||||
|
||||
static int
|
||||
timeout_cb (timer *tim)
|
||||
{
|
||||
if (xchat_set_context (ph, tim->context))
|
||||
if (hexchat_set_context (ph, tim->context))
|
||||
{
|
||||
xchat_command (ph, tim->command);
|
||||
hexchat_command (ph, tim->command);
|
||||
|
||||
if (tim->forever)
|
||||
return 1;
|
||||
@@ -101,13 +101,13 @@ timer_add (int ref, float timeout, int repeat, char *command)
|
||||
tim->repeat = repeat;
|
||||
tim->timeout = timeout;
|
||||
tim->command = strdup (command);
|
||||
tim->context = xchat_get_context (ph);
|
||||
tim->context = hexchat_get_context (ph);
|
||||
tim->forever = FALSE;
|
||||
|
||||
if (repeat == 0)
|
||||
tim->forever = TRUE;
|
||||
|
||||
tim->hook = xchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
|
||||
tim->hook = hexchat_hook_timer (ph, timeout * 1000.0, (void *)timeout_cb, tim);
|
||||
timer_list = g_slist_append (timer_list, tim);
|
||||
}
|
||||
|
||||
@@ -119,17 +119,17 @@ timer_showlist (void)
|
||||
|
||||
if (timer_list == NULL)
|
||||
{
|
||||
xchat_print (ph, "No timers installed.\n");
|
||||
xchat_print (ph, HELP);
|
||||
hexchat_print (ph, "No timers installed.\n");
|
||||
hexchat_print (ph, HELP);
|
||||
return;
|
||||
}
|
||||
/* 00000 00000000 0000000 abc */
|
||||
xchat_print (ph, "\026 Ref# Seconds Repeat Command \026\n");
|
||||
hexchat_print (ph, "\026 Ref# Seconds Repeat Command \026\n");
|
||||
list = timer_list;
|
||||
while (list)
|
||||
{
|
||||
tim = list->data;
|
||||
xchat_printf (ph, "%5d %8.1f %7d %s\n", tim->ref, tim->timeout,
|
||||
hexchat_printf (ph, "%5d %8.1f %7d %s\n", tim->ref, tim->timeout,
|
||||
tim->repeat, tim->command);
|
||||
list = list->next;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ timer_cb (char *word[], char *word_eol[], void *userdata)
|
||||
command = word_eol[3 + offset];
|
||||
|
||||
if (timeout < 0.1 || !command[0])
|
||||
xchat_print (ph, HELP);
|
||||
hexchat_print (ph, HELP);
|
||||
else
|
||||
timer_add (ref, timeout, repeat, command);
|
||||
|
||||
@@ -190,9 +190,9 @@ int
|
||||
#ifdef STATIC
|
||||
timer_plugin_init
|
||||
#else
|
||||
xchat_plugin_init
|
||||
hexchat_plugin_init
|
||||
#endif
|
||||
(xchat_plugin *plugin_handle, char **plugin_name,
|
||||
(hexchat_plugin *plugin_handle, char **plugin_name,
|
||||
char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
/* we need to save this for use with any xchat_* functions */
|
||||
@@ -202,7 +202,7 @@ xchat_plugin_init
|
||||
*plugin_desc = "IrcII style /TIMER command";
|
||||
*plugin_version = "";
|
||||
|
||||
xchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
|
||||
hexchat_hook_command (ph, "TIMER", HEXCHAT_PRI_NORM, timer_cb, HELP, 0);
|
||||
|
||||
return 1; /* return 1 for success */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user