mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-10 16:00:18 +00:00
new name after fork
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* HexChat
|
||||
/* ZoiteChat
|
||||
* Copyright (C) 2015 Patrick Griffis.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -19,11 +19,11 @@
|
||||
#include "config.h"
|
||||
#include <glib.h>
|
||||
|
||||
#include "../common/hexchat-plugin.h"
|
||||
#include "../common/zoitechat-plugin.h"
|
||||
#include "../common/inbound.h" /* For alert_match_word() */
|
||||
#include "notifications/notification-backend.h"
|
||||
|
||||
static hexchat_plugin *ph;
|
||||
static zoitechat_plugin *ph;
|
||||
|
||||
const int CHANNEL_FLAG_BALLOON = 1 << 21;
|
||||
const int CHANNEL_FLAG_BALLOON_UNSET = 1 << 22;
|
||||
@@ -33,27 +33,27 @@ should_alert (void)
|
||||
{
|
||||
int omit_away, omit_focused, omit_tray;
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_focus_omitalerts", NULL, &omit_focused) == 3 && omit_focused)
|
||||
if (zoitechat_get_prefs (ph, "gui_focus_omitalerts", NULL, &omit_focused) == 3 && omit_focused)
|
||||
{
|
||||
const char *status = hexchat_get_info (ph, "win_status");
|
||||
const char *status = zoitechat_get_info (ph, "win_status");
|
||||
|
||||
if (status && !g_strcmp0 (status, "active"))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hexchat_get_prefs (ph, "away_omit_alerts", NULL, &omit_away) == 3 && omit_away)
|
||||
if (zoitechat_get_prefs (ph, "away_omit_alerts", NULL, &omit_away) == 3 && omit_away)
|
||||
{
|
||||
if (hexchat_get_info (ph, "away"))
|
||||
if (zoitechat_get_info (ph, "away"))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_tray_quiet", NULL, &omit_tray) == 3 && omit_tray)
|
||||
if (zoitechat_get_prefs (ph, "gui_tray_quiet", NULL, &omit_tray) == 3 && omit_tray)
|
||||
{
|
||||
int tray_enabled;
|
||||
|
||||
if (hexchat_get_prefs (ph, "gui_tray", NULL, &tray_enabled) == 3 && tray_enabled)
|
||||
if (zoitechat_get_prefs (ph, "gui_tray", NULL, &tray_enabled) == 3 && tray_enabled)
|
||||
{
|
||||
const char *status = hexchat_get_info (ph, "win_status");
|
||||
const char *status = zoitechat_get_info (ph, "win_status");
|
||||
|
||||
if (status && g_strcmp0 (status, "hidden") != 0)
|
||||
return FALSE;
|
||||
@@ -68,7 +68,7 @@ is_ignored (char *nick)
|
||||
{
|
||||
const char *no_hilight;
|
||||
|
||||
if (hexchat_get_prefs (ph, "irc_no_hilight", &no_hilight, NULL) == 1 && no_hilight)
|
||||
if (zoitechat_get_prefs (ph, "irc_no_hilight", &no_hilight, NULL) == 1 && no_hilight)
|
||||
{
|
||||
return alert_match_word (nick, (char*)no_hilight);
|
||||
}
|
||||
@@ -81,13 +81,13 @@ show_notification (const char *title, const char *text)
|
||||
char *stripped_title, *stripped_text;
|
||||
|
||||
/* Strip all colors */
|
||||
stripped_title = hexchat_strip (ph, title, -1, 7);
|
||||
stripped_text = hexchat_strip (ph, text, -1, 7);
|
||||
stripped_title = zoitechat_strip (ph, title, -1, 7);
|
||||
stripped_text = zoitechat_strip (ph, text, -1, 7);
|
||||
|
||||
notification_backend_show (stripped_title, stripped_text);
|
||||
|
||||
hexchat_free (ph, stripped_title);
|
||||
hexchat_free (ph, stripped_text);
|
||||
zoitechat_free (ph, stripped_title);
|
||||
zoitechat_free (ph, stripped_text);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -109,9 +109,9 @@ incoming_hilight_cb (char *word[], gpointer userdata)
|
||||
{
|
||||
int hilight;
|
||||
|
||||
if (hexchat_get_prefs (ph, "input_balloon_hilight", NULL, &hilight) == 3 && hilight && should_alert())
|
||||
if (zoitechat_get_prefs (ph, "input_balloon_hilight", NULL, &hilight) == 3 && hilight && should_alert())
|
||||
{
|
||||
show_notificationf (word[2], _("Highlighted message from: %s (%s)"), word[1], hexchat_get_info (ph, "channel"));
|
||||
show_notificationf (word[2], _("Highlighted message from: %s (%s)"), word[1], zoitechat_get_info (ph, "channel"));
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
@@ -123,7 +123,7 @@ incoming_message_cb (char *word[], gpointer userdata)
|
||||
int flags;
|
||||
int alert = 0;
|
||||
|
||||
flags = hexchat_list_int(ph, NULL, "flags");
|
||||
flags = zoitechat_list_int(ph, NULL, "flags");
|
||||
|
||||
/* Let sure that can alert */
|
||||
if (should_alert()) {
|
||||
@@ -132,12 +132,12 @@ incoming_message_cb (char *word[], gpointer userdata)
|
||||
alert = (flags & CHANNEL_FLAG_BALLOON);
|
||||
} else {
|
||||
/* Else follow global environment */
|
||||
alert = (hexchat_get_prefs(ph, "input_balloon_chans", NULL, &message) == 3 && message);
|
||||
alert = (zoitechat_get_prefs(ph, "input_balloon_chans", NULL, &message) == 3 && message);
|
||||
}
|
||||
}
|
||||
|
||||
if (alert) {
|
||||
show_notificationf(word[2], _("Channel message from: %s (%s)"), word[1], hexchat_get_info(ph, "channel"));
|
||||
show_notificationf(word[2], _("Channel message from: %s (%s)"), word[1], zoitechat_get_info(ph, "channel"));
|
||||
}
|
||||
return HEXCHAT_EAT_NONE;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ incoming_priv_cb (char *word[], gpointer userdata)
|
||||
int flags;
|
||||
int alert = 0;
|
||||
|
||||
flags = hexchat_list_int(ph, NULL, "flags");
|
||||
flags = zoitechat_list_int(ph, NULL, "flags");
|
||||
|
||||
/* Let sure that can alert */
|
||||
if (should_alert()) {
|
||||
@@ -158,15 +158,15 @@ incoming_priv_cb (char *word[], gpointer userdata)
|
||||
alert = (flags & CHANNEL_FLAG_BALLOON);
|
||||
} else {
|
||||
/* Else follow global environment */
|
||||
alert = (hexchat_get_prefs(ph, "input_balloon_priv", NULL, &priv) == 3 && priv);
|
||||
alert = (zoitechat_get_prefs(ph, "input_balloon_priv", NULL, &priv) == 3 && priv);
|
||||
}
|
||||
}
|
||||
|
||||
if (alert)
|
||||
{
|
||||
const char *network = hexchat_get_info (ph, "network");
|
||||
const char *network = zoitechat_get_info (ph, "network");
|
||||
if (!network)
|
||||
network = hexchat_get_info (ph, "server");
|
||||
network = zoitechat_get_info (ph, "server");
|
||||
|
||||
if (userdata != NULL) /* Special event */
|
||||
{
|
||||
@@ -206,7 +206,7 @@ tray_cmd_cb (char *word[], char *word_eol[], gpointer userdata)
|
||||
}
|
||||
|
||||
int
|
||||
notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
notification_plugin_init (zoitechat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
|
||||
{
|
||||
const char* error = NULL;
|
||||
|
||||
@@ -222,24 +222,24 @@ notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, cha
|
||||
return 0;
|
||||
}
|
||||
|
||||
hexchat_hook_print (ph, "Channel Msg Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Action Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Channel Msg Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Channel Action Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
|
||||
|
||||
hexchat_hook_print (ph, "Channel Message", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Action", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
hexchat_hook_print (ph, "Channel Notice", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Channel Message", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Channel Action", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Channel Notice", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
|
||||
|
||||
hexchat_hook_print (ph, "Private Message", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Message to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Action", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
hexchat_hook_print (ph, "Private Action to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Private Message", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Private Message to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Private Action", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
zoitechat_hook_print (ph, "Private Action to Dialog", HEXCHAT_PRI_LOWEST, incoming_priv_cb, NULL);
|
||||
|
||||
/* Special events treated as priv */
|
||||
hexchat_hook_print (ph, "Notice", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (1));
|
||||
hexchat_hook_print (ph, "Invited", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (2));
|
||||
hexchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (3));
|
||||
zoitechat_hook_print (ph, "Notice", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (1));
|
||||
zoitechat_hook_print (ph, "Invited", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (2));
|
||||
zoitechat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_LOWEST, incoming_priv_cb, GINT_TO_POINTER (3));
|
||||
|
||||
hexchat_hook_command (ph, "TRAY", HEXCHAT_PRI_HIGH, tray_cmd_cb, NULL, NULL);
|
||||
zoitechat_hook_command (ph, "TRAY", HEXCHAT_PRI_HIGH, tray_cmd_cb, NULL, NULL);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user