Rebranding for the rest of plugin*

This commit is contained in:
Berke Viktor
2012-10-30 08:42:48 +01:00
parent 97dc13fde7
commit e681eafa78
64 changed files with 1875 additions and 1875 deletions

View File

@@ -90,12 +90,12 @@ int event_cb(char *word[], void *userdata)
{
case CHAN_HILIGHT:
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
_snprintf(szName, 64, "Highlight: %s", xchat_get_info (ph, "channel"));
_snprintf(szName, 64, "Highlight: %s", hexchat_get_info (ph, "channel"));
dwInfoFlags = NIIF_INFO;
break;
case CHAN_MESSAGE:
_snprintf(szInfo, 512, "%s:\r\n%s", word[1], word[2]);
_snprintf(szName, 64, "Channel Message: %s", xchat_get_info (ph, "channel"));
_snprintf(szName, 64, "Channel Message: %s", hexchat_get_info (ph, "channel"));
dwInfoFlags = NIIF_INFO;
break;
case CHAN_TOPIC_CHANGE:
@@ -154,7 +154,7 @@ int event_cb(char *word[], void *userdata)
/***** Use windows instead of balloons, and if its a window should we keep it open ****/
/***** indefinitely? ****/
/**************************************************************************************/
szTemp = xchat_strip_color(szInfo);
szTemp = hexchat_strip_color(szInfo);
if(g_dwPrefs & (1<<PREF_UWIOB))
{
@@ -186,7 +186,7 @@ int command_cb(char *word[], char *word_eol[], void *userdata)
int iTime = g_iTime*1000;
_snprintf(szInfo, 512, word_eol[2]);
szTemp = xchat_strip_color(szInfo);
szTemp = hexchat_strip_color(szInfo);
if(g_dwPrefs & (1<<PREF_KAOI))
{
@@ -223,7 +223,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
/*******************************************/
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
/**************************************************/
@@ -266,7 +266,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
/*******************************************/
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
/**************************************************/
@@ -299,7 +299,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
if(g_dwPrefs & (1<<PREF_AOM))
{
xchat_globally_back();
hexchat_globally_back();
}
}
else
@@ -344,7 +344,7 @@ LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg, WPARAM wparam, LPARAM lparam)
if(msg == RegisterWindowMessage(_T("TaskbarCreated")))
{
char szVersion[64];
_snprintf(szVersion, 64, "HexChat [%s]", xchat_get_info(ph, "version"));
_snprintf(szVersion, 64, "HexChat [%s]", hexchat_get_info(ph, "version"));
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
}
}
@@ -378,7 +378,7 @@ LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
if((!g_iIsActive) && (g_dwPrefs & (1<<PREF_AOM)))
{
xchat_globally_back();
hexchat_globally_back();
g_iIsActive = 1;
}
}
@@ -390,27 +390,27 @@ LRESULT CALLBACK sdTrayProc(HWND hWnd, int msg)
break;
case ACT_AWAY:
{
xchat_globally_away(g_szAway);
hexchat_globally_away(g_szAway);
}
break;
case ACT_BACK:
{
xchat_globally_back();
hexchat_globally_back();
}
break;
default:
{
if(msg > 0)
{
xchat_set_context(ph, xchat_find_server(msg-1));
hexchat_set_context(ph, hexchat_find_server(msg-1));
if(!xchat_get_info(ph, "away"))
if(!hexchat_get_info(ph, "away"))
{
xchat_away(g_szAway);
hexchat_away(g_szAway);
}
else
{
xchat_back();
hexchat_back();
}
}
}

View File

@@ -29,7 +29,7 @@
#include "utility.h"
// from util.c of xchat source code ( slightly modified to fit X-Tray Syntax )
char *xchat_strip_color (char *text)
char *hexchat_strip_color (char *text)
{
int nc = 0;
int i = 0;
@@ -155,7 +155,7 @@ void check_special_chars (char *cmd)
}
}
void xchat_globally_away(TCHAR *tszAway)
void hexchat_globally_away(TCHAR *tszAway)
{
char szTemp[512];
char szAway[512];
@@ -163,10 +163,10 @@ void xchat_globally_away(TCHAR *tszAway)
ConvertString(tszAway, szAway, 512);
_snprintf(szTemp, 512, "ALLSERV AWAY %s\0", szAway);
check_special_chars(szTemp);
xchat_exec(szTemp);
hexchat_exec(szTemp);
}
void xchat_away(TCHAR *tszAway)
void hexchat_away(TCHAR *tszAway)
{
char szTemp[512];
char szAway[512];
@@ -174,42 +174,42 @@ void xchat_away(TCHAR *tszAway)
ConvertString(tszAway, szAway, 512);
_snprintf(szTemp, 512, szAway);
check_special_chars(szTemp);
xchat_commandf(ph, "AWAY %s\0", szTemp);
hexchat_commandf(ph, "AWAY %s\0", szTemp);
}
void xchat_globally_back()
void hexchat_globally_back()
{
std::vector<int> xs;
std::vector<int>::iterator xsi;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_list *xl = hexchat_list_get(ph, "channels");
if(xl)
{
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id"));
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
if((xsi == xs.end()) &&
((strlen(xchat_list_str(ph, xl, "server")) > 0) ||
(strlen(xchat_list_str(ph, xl, "channel")) > 0)))
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
{
xs.push_back(xchat_list_int(ph, xl, "id"));
xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context"));
xchat_back();
xs.push_back(hexchat_list_int(ph, xl, "id"));
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
hexchat_back();
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
}
}
void xchat_back()
void hexchat_back()
{
if(xchat_get_info(ph, "away"))
if(hexchat_get_info(ph, "away"))
{
xchat_command(ph, "BACK");
hexchat_command(ph, "BACK");
}
}
@@ -222,7 +222,7 @@ HMENU setServerMenu()
std::vector<int> xs;
std::vector<int>::iterator xsi;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_list *xl = hexchat_list_get(ph, "channels");
AppendMenu(sTemp, MF_STRING, ACT_AWAY, _T("Set Globally Away"));
AppendMenu(sTemp, MF_STRING, ACT_BACK, _T("Set Globally Back"));
@@ -230,20 +230,20 @@ HMENU setServerMenu()
if(xl)
{
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
xsi = std::find(xs.begin(), xs.end(), xchat_list_int(ph, xl, "id"));
xsi = std::find(xs.begin(), xs.end(), hexchat_list_int(ph, xl, "id"));
if( (xsi == xs.end()) &&
((strlen(xchat_list_str(ph, xl, "server")) > 0) ||
(strlen(xchat_list_str(ph, xl, "channel")) > 0)))
((strlen(hexchat_list_str(ph, xl, "server")) > 0) ||
(strlen(hexchat_list_str(ph, xl, "channel")) > 0)))
{
xchat_set_context(ph, (xchat_context *)xchat_list_str(ph, xl, "context"));
xs.push_back(xchat_list_int(ph, xl, "id"));
hexchat_set_context(ph, (hexchat_context *)hexchat_list_str(ph, xl, "context"));
xs.push_back(hexchat_list_int(ph, xl, "id"));
char *network = _strdup(xchat_list_str(ph, xl, "network"));
char *server = _strdup(xchat_list_str(ph, xl, "server"));
char *nick = _strdup(xchat_get_info(ph, "nick"));
char *network = _strdup(hexchat_list_str(ph, xl, "network"));
char *server = _strdup(hexchat_list_str(ph, xl, "server"));
char *nick = _strdup(hexchat_get_info(ph, "nick"));
if(network != NULL)
{
@@ -259,13 +259,13 @@ HMENU setServerMenu()
ConvertString(nick, wszNick, 128);
_sntprintf(wszMenuEntry, 256, _T("%s @ %s\0"), wszNick, wszServer);
if(!xchat_get_info(ph, "away"))
if(!hexchat_get_info(ph, "away"))
{
AppendMenu(sTemp, MF_STRING, (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
AppendMenu(sTemp, MF_STRING, (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
}
else
{
AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (xchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
AppendMenu(sTemp, (MF_CHECKED | MF_STRING), (hexchat_list_int(ph, xl, "id") + 1), wszMenuEntry);
}
}
@@ -275,24 +275,24 @@ HMENU setServerMenu()
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
}
return sTemp;
}
struct _xchat_context *xchat_find_server(int find_id)
struct _hexchat_context *hexchat_find_server(int find_id)
{
xchat_context *xc;
xchat_list *xl = xchat_list_get(ph, "channels");
hexchat_context *xc;
hexchat_list *xl = hexchat_list_get(ph, "channels");
int id;
if(!xl)
return NULL;
while(xchat_list_next(ph, xl))
while(hexchat_list_next(ph, xl))
{
id = xchat_list_int(ph, xl, "id");
id = hexchat_list_int(ph, xl, "id");
if(id == -1)
{
@@ -300,21 +300,21 @@ struct _xchat_context *xchat_find_server(int find_id)
}
else if(id == find_id)
{
xc = (xchat_context *)xchat_list_str(ph, xl, "context");
xc = (hexchat_context *)hexchat_list_str(ph, xl, "context");
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
return xc;
}
}
xchat_list_free(ph, xl);
hexchat_list_free(ph, xl);
return NULL;
}
void xchat_exec(char *command)
void hexchat_exec(char *command)
{
xchat_set_context(ph, xchat_find_context(ph, NULL, NULL));
xchat_command(ph, command);
hexchat_set_context(ph, hexchat_find_context(ph, NULL, NULL));
hexchat_command(ph, command);
}

View File

@@ -19,14 +19,14 @@
#ifndef _H_XCHAT_H
#define _H_XCHAT_H
void xchat_exec (char *);
char *xchat_strip_color (char *);
void xchat_parse (char *);
struct _xchat_context *xchat_find_server (int);
void xchat_globally_away (TCHAR *);
void xchat_away (TCHAR *);
void xchat_globally_back ();
void xchat_back ();
void hexchat_exec (char *);
char *hexchat_strip_color (char *);
void hexchat_parse (char *);
struct _hexchat_context *hexchat_find_server (int);
void hexchat_globally_away (TCHAR *);
void hexchat_away (TCHAR *);
void hexchat_globally_back ();
void hexchat_back ();
HMENU setServerMenu ();
#endif

View File

@@ -34,13 +34,13 @@
/*****************************************************/
/**** Don't want to pollute the namespace do we? *****/
/*****************************************************/
std::list<xchat_hook *> g_vHooks;
std::list<hexchat_hook *> g_vHooks;
/*****************************************************/
/************ Global Identifiers *********************/
/*****************************************************/
WNDPROC g_hOldProc;
xchat_plugin *ph;
hexchat_plugin *ph;
/*****************************************************/
/***************** Resources *************************/
@@ -69,7 +69,7 @@ BOOL WINAPI DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpVoid)
return TRUE;
}
int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg)
{
ph = plugin_handle;
@@ -83,25 +83,25 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/************************* Initialize our preferences if they don't exist yet **********************************************/
/***************************************************************************************************************************/
if (xchat_pluginpref_get_int (ph, "settings") == -1)
if (hexchat_pluginpref_get_int (ph, "settings") == -1)
{
xchat_pluginpref_set_int (ph, "settings", HT_DEF_SET);
hexchat_pluginpref_set_int (ph, "settings", HT_DEF_SET);
}
if (xchat_pluginpref_get_int (ph, "aot") == -1)
if (hexchat_pluginpref_get_int (ph, "aot") == -1)
{
xchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT);
hexchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT);
}
if (xchat_pluginpref_get_int (ph, "key") == -1)
if (hexchat_pluginpref_get_int (ph, "key") == -1)
{
xchat_pluginpref_set_int (ph, "key", HT_DEF_KEY);
hexchat_pluginpref_set_int (ph, "key", HT_DEF_KEY);
}
if (xchat_pluginpref_get_int (ph, "mod") == -1)
if (hexchat_pluginpref_get_int (ph, "mod") == -1)
{
xchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD);
hexchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD);
}
if (xchat_pluginpref_get_str (ph, "away", buffer) == 0)
if (hexchat_pluginpref_get_str (ph, "away", buffer) == 0)
{
xchat_pluginpref_set_str (ph, "away", "");
hexchat_pluginpref_set_str (ph, "away", "");
}
/***************************************************************************************************************************/
@@ -112,7 +112,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/***************************************************************************************************************************/
/************************* Finds the HexChat window and saves it for later use *********************************************/
/***************************************************************************************************************************/
g_hXchatWnd = (HWND)xchat_get_info(ph, "win_ptr");
g_hXchatWnd = (HWND)hexchat_get_info(ph, "win_ptr");
if(g_hXchatWnd == NULL)
{
@@ -143,7 +143,7 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/************************* Add our icon to the tray ************************************************************************/
/***************************************************************************************************************************/
char szVersion[64];
_snprintf(szVersion, 64, "HexChat %s", xchat_get_info(ph, "version"));
_snprintf(szVersion, 64, "HexChat %s", hexchat_get_info(ph, "version"));
AddIcon(g_hXchatWnd, 1, g_hIcons[0], szVersion, (NIF_ICON | NIF_MESSAGE | NIF_TIP), WM_TRAYMSG);
/***************************************************************************************************************************/
@@ -161,25 +161,25 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, char **plugin_name, char **pl
/***************************************************************************************************************************/
/************************* Set our hooks and save them for later so we can unhook them *************************************/
/***************************************************************************************************************************/
g_vHooks.push_back(xchat_hook_print(ph, "Channel Msg Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(xchat_hook_print(ph, "Channel Message", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE));
g_vHooks.push_back(xchat_hook_print(ph, "Topic Change", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE));
g_vHooks.push_back(xchat_hook_print(ph, "Channel Action Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(xchat_hook_print(ph, "Channel INVITE", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE));
g_vHooks.push_back(xchat_hook_print(ph, "You Kicked", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_KICKED));
g_vHooks.push_back(xchat_hook_print(ph, "Banned", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_BANNED));
g_vHooks.push_back(xchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, event_cb, (void *)CTCP_GENERIC));
g_vHooks.push_back(xchat_hook_print(ph, "Private Message", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(xchat_hook_print(ph, "Private Message to Dialog", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(xchat_hook_print(ph, "Disconnected", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_DISCONNECT));
g_vHooks.push_back(xchat_hook_print(ph, "Killed", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_KILLED));
g_vHooks.push_back(xchat_hook_print(ph, "Notice", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_NOTICE));
g_vHooks.push_back(xchat_hook_command(ph, "tray_alert", HEXCHAT_PRI_NORM, command_cb, "Create an Alert", NULL));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Msg Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Message", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_MESSAGE));
g_vHooks.push_back(hexchat_hook_print(ph, "Topic Change", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_TOPIC_CHANGE));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel Action Hilight", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_HILIGHT));
g_vHooks.push_back(hexchat_hook_print(ph, "Channel INVITE", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_INVITE));
g_vHooks.push_back(hexchat_hook_print(ph, "You Kicked", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_KICKED));
g_vHooks.push_back(hexchat_hook_print(ph, "Banned", HEXCHAT_PRI_NORM, event_cb, (void *)CHAN_BANNED));
g_vHooks.push_back(hexchat_hook_print(ph, "CTCP Generic", HEXCHAT_PRI_NORM, event_cb, (void *)CTCP_GENERIC));
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(hexchat_hook_print(ph, "Private Message to Dialog", HEXCHAT_PRI_NORM, event_cb, (void *)PMSG_RECEIVE));
g_vHooks.push_back(hexchat_hook_print(ph, "Disconnected", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_DISCONNECT));
g_vHooks.push_back(hexchat_hook_print(ph, "Killed", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_KILLED));
g_vHooks.push_back(hexchat_hook_print(ph, "Notice", HEXCHAT_PRI_NORM, event_cb, (void *)SERV_NOTICE));
g_vHooks.push_back(hexchat_hook_command(ph, "tray_alert", HEXCHAT_PRI_NORM, command_cb, "Create an Alert", NULL));
return 1;
}
int xchat_plugin_deinit(xchat_plugin *plugin_handle)
int hexchat_plugin_deinit(hexchat_plugin *plugin_handle)
{
/******************************************/
/****** Remove the Icon from the tray *****/
@@ -231,13 +231,13 @@ int xchat_plugin_deinit(xchat_plugin *plugin_handle)
sdCloseAlerts();
}
/******************************************/
/****** remove our xchat_hook_*s **********/
/****** remove our hexchat_hook_*s **********/
/******************************************/
while(!g_vHooks.empty())
{
if(g_vHooks.back() != NULL)
{
xchat_unhook(ph, g_vHooks.back());
hexchat_unhook(ph, g_vHooks.back());
}
g_vHooks.pop_back();
}

View File

@@ -1,3 +1,3 @@
EXPORTS
xchat_plugin_init
xchat_plugin_deinit
hexchat_plugin_init
hexchat_plugin_deinit

View File

@@ -36,7 +36,7 @@ extern unsigned int g_dwPrefs;
extern TCHAR g_szAway[512];
extern int g_iTime;
extern WNDPROC g_hOldProc;
extern struct _xchat_plugin *ph;
extern struct _hexchat_plugin *ph;
/******************************************************/
/******************** Messages ************************/

View File

@@ -74,11 +74,11 @@ WORD ModToHotkeyf(WORD modifiers)
void SavePrefs(int iDlg)
{
xchat_pluginpref_set_int (ph, "settings", g_dwPrefs);
xchat_pluginpref_set_int (ph, "aot", g_iTime);
xchat_pluginpref_set_int (ph, "key", g_hHotKey.key);
xchat_pluginpref_set_int (ph, "mod", g_hHotKey.mod);
xchat_pluginpref_set_str (ph, "away", (const char*) g_szAway);
hexchat_pluginpref_set_int (ph, "settings", g_dwPrefs);
hexchat_pluginpref_set_int (ph, "aot", g_iTime);
hexchat_pluginpref_set_int (ph, "key", g_hHotKey.key);
hexchat_pluginpref_set_int (ph, "mod", g_hHotKey.mod);
hexchat_pluginpref_set_str (ph, "away", (const char*) g_szAway);
}
void LoadPrefs()
@@ -91,11 +91,11 @@ void LoadPrefs()
/*************************** Get the value for each of our preferances ****************************/
/**************************************************************************************************/
g_dwPrefs = xchat_pluginpref_get_int (ph, "settings");
g_iTime = xchat_pluginpref_get_int (ph, "aot");
g_hHotKey.key = xchat_pluginpref_get_int (ph, "key");
g_hHotKey.mod = xchat_pluginpref_get_int (ph, "mod");
xchat_pluginpref_get_str (ph, "away", (char *) g_szAway);
g_dwPrefs = hexchat_pluginpref_get_int (ph, "settings");
g_iTime = hexchat_pluginpref_get_int (ph, "aot");
g_hHotKey.key = hexchat_pluginpref_get_int (ph, "key");
g_hHotKey.mod = hexchat_pluginpref_get_int (ph, "mod");
hexchat_pluginpref_get_str (ph, "away", (char *) g_szAway);
/**************************************************************************************************/
/******************************** Register our hotkey with windows ********************************/