/** * Plugin entry point. */ int hexchat_plugin_init(hexchat_plugin *plugin_handle, const char **name, const char **desc, const char **version, char *arg) { ph = plugin_handle; /* Send our info to HexChat */ *name = plugin_name; *desc = plugin_desc; *version = plugin_version; /* Register commands */ hexchat_hook_command(ph, "SETKEY", HEXCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL); hexchat_hook_command(ph, "DELKEY", HEXCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL); hexchat_hook_command(ph, "GETKEY", HEXCHAT_PRI_NORM, handle_getkey, usage_getkey, NULL); /* Add handlers */ hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, handle_outgoing, NULL, NULL); hexchat_hook_server(ph, "NOTICE", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server(ph, "PRIVMSG", HEXCHAT_PRI_NORM, handle_incoming, NULL); //hexchat_hook_server(ph, "RAW LINE", HEXCHAT_PRI_NORM, handle_debug, NULL); hexchat_hook_server(ph, "TOPIC", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_hook_server(ph, "332", HEXCHAT_PRI_NORM, handle_incoming, NULL); hexchat_printf(ph, "%s plugin loaded\n", plugin_name); /* Return success */ return 1; }
int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; char buffer[bsize]; hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, sysinfo_cb, sysinfo_help, NULL); hexchat_hook_command (ph, "NETDATA", HEXCHAT_PRI_NORM, netdata_cb, NULL, NULL); hexchat_hook_command (ph, "NETSTREAM", HEXCHAT_PRI_NORM, netstream_cb, NULL, NULL); /* this is required for the very first run */ if (hexchat_pluginpref_get_str (ph, "pciids", buffer) == 0) { hexchat_pluginpref_set_str (ph, "pciids", DEFAULT_PCIIDS); } if (hexchat_pluginpref_get_str (ph, "format", buffer) == 0) { hexchat_pluginpref_set_str (ph, "format", DEFAULT_FORMAT); } if (hexchat_pluginpref_get_int (ph, "percent") == -1) { hexchat_pluginpref_set_int (ph, "percent", DEFAULT_PERCENT); } hexchat_command (ph, "MENU ADD \"Window/Display System Info\" \"SYSINFO\""); hexchat_printf (ph, "%s plugin loaded\n", name); return 1; }
G_MODULE_EXPORT int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **name, char **description, char **version, char *arg) { if (g_str_has_prefix(LUA_VERSION, "Lua ")) { strcat(plugin_version, "/"); g_strlcat(plugin_version, LUA_VERSION + 4, sizeof(plugin_version)); } *name = plugin_name; *description = plugin_description; *version = plugin_version; ph = plugin_handle; hexchat_hook_command(ph, "", HEXCHAT_PRI_NORM, command_console_exec, NULL, NULL); hexchat_hook_command(ph, "LOAD", HEXCHAT_PRI_NORM, command_load, NULL, NULL); hexchat_hook_command(ph, "UNLOAD", HEXCHAT_PRI_NORM, command_unload, NULL, NULL); hexchat_hook_command(ph, "RELOAD", HEXCHAT_PRI_NORM, command_reload, NULL, NULL); hexchat_hook_command(ph, "lua", HEXCHAT_PRI_NORM, command_lua, command_help, NULL); hexchat_printf(ph, "%s version %s loaded.\n", plugin_name, plugin_version); scripts = g_ptr_array_new_with_free_func((GDestroyNotify)destroy_script); create_interpreter(); if(!arg) autoload_scripts(); return 1; }
int notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { if (!notification_backend_init ()) return 0; ph = plugin_handle; *plugin_name = ""; *plugin_desc = ""; *plugin_version = ""; 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); 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); 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); /* 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)); hexchat_hook_command (ph, "TRAY", HEXCHAT_PRI_HIGH, tray_cmd_cb, NULL, NULL); return 1; }
int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { int delay; ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; /* these are required for the very first run */ delay = hexchat_pluginpref_get_int (ph, "delay"); if (delay == -1) { delay = DEFAULT_DELAY; hexchat_pluginpref_set_int (ph, "delay", DEFAULT_DELAY); } if (hexchat_pluginpref_get_int (ph, "freq") == -1) { hexchat_pluginpref_set_int (ph, "freq", DEFAULT_FREQ); } hexchat_hook_command (ph, "UPDCHK", HEXCHAT_PRI_NORM, print_version, upd_help, NULL); hexchat_hook_timer (ph, delay * 1000, delayed_check, NULL); hexchat_command (ph, "MENU -ietc\\download.png ADD \"Help/Check for Updates\" \"UPDCHK\""); hexchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ }
int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { /* we need to save this for use with any hexchat_* functions */ ph = plugin_handle; /* tell HexChat our info */ *plugin_name = name; *plugin_desc = desc; *plugin_version = version; hexchat_hook_command (ph, "SASL", HEXCHAT_PRI_NORM, sasl_cmd_cb, sasl_help, 0); hexchat_hook_print (ph, "Connected", HEXCHAT_PRI_NORM, connect_cb, NULL); /* hexchat_hook_print (ph, "Disconnected", HEXCHAT_PRI_NORM, disconnect_cb, NULL); */ hexchat_hook_server (ph, "CAP", HEXCHAT_PRI_NORM, cap_cb, NULL); hexchat_hook_server (ph, "RAW LINE", HEXCHAT_PRI_NORM, server_cb, NULL); hexchat_hook_server (ph, "903", HEXCHAT_PRI_NORM, authend_cb, NULL); hexchat_hook_server (ph, "904", HEXCHAT_PRI_NORM, authend_cb, NULL); hexchat_hook_server (ph, "905", HEXCHAT_PRI_NORM, authend_cb, NULL); hexchat_hook_server (ph, "906", HEXCHAT_PRI_NORM, authend_cb, NULL); hexchat_hook_server (ph, "907", HEXCHAT_PRI_NORM, authend_cb, NULL); hexchat_printf (ph, "%s plugin loaded\n", name); return 1; }
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg){ ph = plugin_handle; *plugin_name = "mpcInfo"; *plugin_desc = "Information-Script for Media Player Classic"; *plugin_version=VERSION; hexchat_hook_command(ph, "mpc", HEXCHAT_PRI_NORM, mpc_tell,"no help text", 0); hexchat_hook_command(ph, "mpc_themes", HEXCHAT_PRI_NORM, print_themes,"no help text", 0); hexchat_hook_command(ph, "mpc_reloadthemes", HEXCHAT_PRI_NORM, mpc_themeReload,"no help text", 0); hexchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (MPC)\" \"MPC\""); themeInit(); loadThemes(); hexchat_printf(ph, "%s %s plugin loaded\n",*plugin_name, VERSION); return 1; }
/* Xchat::Internal::hook_command(name, priority, callback, help_text, userdata) */ static XS (XS_Xchat_hook_command) { char *name; int pri; SV *callback; char *help_text = NULL; SV *userdata; SV *package; hexchat_hook *hook; HookData *data; dXSARGS; if (items != 6) { hexchat_print (ph, "Usage: Xchat::Internal::hook_command(name, priority, callback, help_text, userdata, package)"); } else { name = SvPV_nolen (ST (0)); pri = (int) SvIV (ST (1)); callback = ST (2); /* leave the help text as NULL if the help text is undefined to avoid * overriding the default help message for builtin commands */ if (SvOK(ST (3))) { help_text = SvPV_nolen (ST (3)); } userdata = ST (4); package = ST (5); data = NULL; data = malloc (sizeof (HookData)); if (data == NULL) { XSRETURN_UNDEF; } data->callback = newSVsv (callback); data->userdata = newSVsv (userdata); data->depth = 0; data->package = newSVsv (package); hook = hexchat_hook_command (ph, name, pri, command_cb, help_text, data); XSRETURN_IV (PTR2IV (hook)); } }
int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; firstRun = 1; hexchat_hook_command (ph, "SYSINFO", HEXCHAT_PRI_NORM, printInfo, helptext, NULL); hexchat_command (ph, "MENU -ishare\\system.png ADD \"Window/Send System Info\" \"SYSINFO\""); hexchat_printf (ph, "%s plugin loaded\n", name); return 1; /* return 1 for success */ }
int identd_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = ""; *plugin_desc = ""; *plugin_version = ""; responses = g_hash_table_new_full (NULL, NULL, NULL, g_free); hexchat_hook_command (ph, "IDENTD", HEXCHAT_PRI_NORM, identd_command_cb, _("IDENTD <port> <username>"), NULL); identd_start_server (); return 1; /* This must always succeed for /identd to work */ }
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { /* we need to save this for use with any hexchat_* functions */ ph = plugin_handle; *plugin_name = "Winamp"; *plugin_desc = "Winamp plugin for HexChat"; *plugin_version = "0.5"; hexchat_hook_command (ph, "WINAMP", HEXCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0); hexchat_command (ph, "MENU -ishare\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\""); hexchat_print (ph, "Winamp plugin loaded\n"); return 1; /* return 1 for success */ }
int hexchat_plugin_init(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 */ ph = plugin_handle; *plugin_name = "EasyWinampControl"; *plugin_desc = "Plugin for remotely controlling Winamp"; *plugin_version = "1.3.8"; hexchat_hook_command(ph, "wp", HEXCHAT_PRI_NORM, wp_cb, "Usage: wp [ n | b | p | s | q ]\n"\ " next prev play stop pause\n", 0); hexchat_printf(ph, "%s %s plugin loaded successfully!\n", *plugin_name, *plugin_version); return 1; /* Return 1 for success */ }
int hexchat_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = name; *plugin_desc = desc; *plugin_version = version; /* this is required for the very first run */ if (hexchat_pluginpref_get_int (ph, "limit") == -1) { hexchat_pluginpref_set_int (ph, "limit", DEFAULT_LIMIT); } hexchat_hook_command (ph, "CHECKSUM", HEXCHAT_PRI_NORM, checksum, "Usage: /CHECKSUM GET|SET", 0); hexchat_hook_print (ph, "DCC RECV Complete", HEXCHAT_PRI_NORM, dccrecv_cb, NULL); hexchat_hook_print (ph, "DCC Offer", HEXCHAT_PRI_NORM, dccoffer_cb, NULL); hexchat_printf (ph, "%s plugin loaded\n", name); return 1; }
static int api_hexchat_hook_command(lua_State *L) { hook_info *info, **u; char const *command, *help; int ref, pri; command = luaL_optstring(L, 1, ""); lua_pushvalue(L, 2); ref = luaL_ref(L, LUA_REGISTRYINDEX); help = luaL_optstring(L, 3, NULL); pri = luaL_optinteger(L, 4, HEXCHAT_PRI_NORM); info = g_new(hook_info, 1); info->state = L; info->ref = ref; info->hook = hexchat_hook_command(ph, command, pri, api_command_closure, help, info); u = lua_newuserdata(L, sizeof(hook_info *)); *u = info; luaL_newmetatable(L, "hook"); lua_setmetatable(L, -2); register_hook(info); return 1; }
int hexchat_plugin_init(hexchat_plugin *plugin_handle, char **plugin_name, char **plugin_desc, char **plugin_version, char *arg) { ph = plugin_handle; *plugin_name = "HexTray"; *plugin_desc = "Minimize HexChat to the Windows system tray"; *plugin_version = "1.3.0"; char buffer[256]; /***************************************************************************************************************************/ /************************* Initialize our preferences if they don't exist yet **********************************************/ /***************************************************************************************************************************/ if (hexchat_pluginpref_get_int (ph, "settings") == -1) { hexchat_pluginpref_set_int (ph, "settings", HT_DEF_SET); } if (hexchat_pluginpref_get_int (ph, "aot") == -1) { hexchat_pluginpref_set_int (ph, "aot", HT_DEF_AOT); } if (hexchat_pluginpref_get_int (ph, "key") == -1) { hexchat_pluginpref_set_int (ph, "key", HT_DEF_KEY); } if (hexchat_pluginpref_get_int (ph, "mod") == -1) { hexchat_pluginpref_set_int (ph, "mod", HT_DEF_MOD); } if (hexchat_pluginpref_get_str (ph, "away", buffer) == 0) { hexchat_pluginpref_set_str (ph, "away", ""); } /***************************************************************************************************************************/ /************************* Load our preferences ****************************************************************************/ /***************************************************************************************************************************/ LoadPrefs(); /***************************************************************************************************************************/ /************************* Finds the HexChat window and saves it for later use *********************************************/ /***************************************************************************************************************************/ g_hXchatWnd = (HWND)hexchat_get_info(ph, "win_ptr"); if(g_hXchatWnd == NULL) { EnumThreadWindows(GetCurrentThreadId(), EnumWindowsProc, 0); } g_hOldProc = (WNDPROC)GetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC); SetWindowLongPtr(g_hXchatWnd, GWLP_WNDPROC, (LONG_PTR)WindowProc); /***************************************************************************************************************************/ /************************* Grab the HexChat Icon, Load our menu, create the window to receive the hotkey messages *********/ /************************* and register the windows message so we know if explorer crashes ***********/ /***************************************************************************************************************************/ g_hTrayMenu = GetSubMenu(LoadMenu((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDR_TRAY_MENU)), 0); g_hHotkeyWnd = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_ALERT), NULL, (DLGPROC)HotKeyProc); g_hPrefDlg = CreateDialog((HINSTANCE)g_hInstance, MAKEINTRESOURCE(IDD_PREF), g_hXchatWnd, (DLGPROC)PrefProc); g_hIcons[0] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_XCHAT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[2] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_HIGHLIGHT), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[5] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_BANNED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[6] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_KICKED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[8] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_PMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[10]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_SNOTICE), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[11]= (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_DISCONNECTED), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); g_hIcons[22] = (HICON)LoadImage((HINSTANCE)g_hInstance, MAKEINTRESOURCE(ICO_CHANMSG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR); /***************************************************************************************************************************/ /************************* Add our icon to the tray ************************************************************************/ /***************************************************************************************************************************/ char szVersion[64]; _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); /***************************************************************************************************************************/ /***************************************************************************************************************************/ /***************************************************************************************************************************/ if(g_dwPrefs & (1<<PREF_DNSIT)) { DWORD dwStyle; dwStyle = GetWindowLong(g_hXchatWnd, GWL_STYLE); dwStyle |= (1<<WS_CHILD); SetWindowLongPtr(g_hXchatWnd, GWL_STYLE, (LONG_PTR)dwStyle); SetWindowLongPtr(g_hXchatWnd, GWL_HWNDPARENT, (LONG_PTR)g_hHotkeyWnd); } /***************************************************************************************************************************/ /************************* Set our hooks and save them for later so we can unhook them *************************************/ /***************************************************************************************************************************/ 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; }