/* this is used for autoload and shutdown callbacks */ static int execute_perl (SV * function, char *args) { int count, ret_value = 1; dSP; ENTER; SAVETMPS; PUSHMARK (SP); XPUSHs (sv_2mortal (newSVpv (args, 0))); PUTBACK; count = call_sv (function, G_EVAL | G_SCALAR); SPAGAIN; if (SvTRUE (ERRSV)) { hexchat_printf(ph, "Perl error: %s\n", SvPV_nolen (ERRSV)); if (!SvOK (POPs)) {} /* remove undef from the top of the stack */ } else if (count != 1) { hexchat_printf (ph, "Perl error: expected 1 value from %s, " "got: %d\n", SvPV_nolen (function), count); } else { ret_value = POPi; } PUTBACK; FREETMPS; LEAVE; return ret_value; }
/** * Command handler for /setkey */ static int handle_setkey(char *word[], char *word_eol[], void *userdata) { const char *nick; const char *key; // Check syntax if (*word[2] == '\0') { hexchat_printf(ph, "%s\n", usage_setkey); return HEXCHAT_EAT_HEXCHAT; } if (*word[3] == '\0') { // /setkey password nick = hexchat_get_info(ph, "channel"); key = word_eol[2]; } else { // /setkey #channel password //nick = word[2]; nick = word[2]; key = word_eol[3]; } // Set password if (keystore_store_key(nick, key)) { hexchat_printf(ph, "Stored key for %s\n", nick); } else { hexchat_printf(ph, "\00305Failed to store key in blow.ini\n", nick, key); } return HEXCHAT_EAT_HEXCHAT; }
static int dccoffer_cb (char *word[], void *userdata) { int result; struct stat buffer; /* buffer for storing file info */ char sum[65]; /* buffer for checksum */ result = stat (word[3], &buffer); if (result == 0) /* stat returns 0 on success */ { if (buffer.st_size <= (unsigned long long) get_limit () * 1048576) { sha256_file (word[3], sum); /* word[3] is the full filename */ hexchat_commandf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): %s", word[2], word[1], sum); } else { hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3])); hexchat_printf (ph, "quote PRIVMSG %s :SHA-256 checksum for %s (remote): (size limit reached, no checksum calculated)", word[2], word[1]); } } else { hexchat_printf (ph, "File access error!\n"); } return HEXCHAT_EAT_NONE; }
static int print_ram (int announce, char* format) { unsigned long long mem_total; unsigned long long mem_free; unsigned long long swap_total; unsigned long long swap_free; char string[bsize]; if (xs_parse_meminfo (&mem_total, &mem_free, 0) == 1) { hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name); return HEXCHAT_EAT_ALL; } if (xs_parse_meminfo (&swap_total, &swap_free, 1) == 1) { hexchat_printf (ph, "%s\tERROR in parse_meminfo!", name); return HEXCHAT_EAT_ALL; } snprintf (string, bsize, "%s - %s", pretty_freespace ("Physical", &mem_free, &mem_total), pretty_freespace ("Swap", &swap_free, &swap_total)); format_output ("RAM", string, format); if (announce) { hexchat_commandf (ph, "SAY %s", string); } else { hexchat_printf (ph, "%s", string); } return HEXCHAT_EAT_ALL; }
static int print_os (int announce, char* format) { char buffer[bsize]; char user[bsize]; char host[bsize]; char kernel[bsize]; if (xs_parse_os (user, host, kernel) != 0) { hexchat_printf (ph, "%s\tERROR in parse_os()", name); return HEXCHAT_EAT_ALL; } snprintf (buffer, bsize, "%s@%s, %s", user, host, kernel); format_output ("OS", buffer, format); if (announce) { hexchat_commandf (ph, "SAY %s", buffer); } else { hexchat_printf (ph, "%s", buffer); } return HEXCHAT_EAT_ALL; }
static void inject_string(script_info *info, char const *line) { lua_State *L = info->state; int base, top; char *ret_line; gboolean force_ret = FALSE; if(line[0] == '=') { line++; force_ret = TRUE; } ret_line = g_strconcat("return ", line, NULL); lua_rawgeti(L, LUA_REGISTRYINDEX, info->traceback); base = lua_gettop(L); if(luaL_loadbuffer(L, ret_line, strlen(ret_line), "@interpreter")) { if(!force_ret) lua_pop(L, 1); if(force_ret || luaL_loadbuffer(L, line, strlen(line), "@interpreter")) { hexchat_printf(ph, "Lua syntax error: %s", luaL_optstring(L, -1, "")); lua_pop(L, 2); g_free(ret_line); return; } } g_free(ret_line); info->status |= STATUS_ACTIVE; if(lua_pcall(L, 0, LUA_MULTRET, base)) { char const *error = lua_tostring(L, -1); lua_pop(L, 2); hexchat_printf(ph, "Lua error: %s", error ? error : "(non-string error)"); return; } top = lua_gettop(L); if(top > base) { int i; luaL_Buffer b; luaL_buffinit(L, &b); for(i = base + 1; i <= top; i++) { if(i != base + 1) luaL_addstring(&b, " "); tostring(L, i); luaL_addvalue(&b); } luaL_pushresult(&b); hexchat_print(ph, lua_tostring(L, -1)); lua_pop(L, top - base + 1); } lua_pop(L, 1); check_deferred(info); }
void printThemes() { hexchat_printf(ph,"\nNotRun-Theme:\n"); printTheme(notRunTheme); hexchat_printf(ph,"\nMP3-Theme:\n"); printTheme(mp3Theme); hexchat_printf(ph,"\nOGG-Theme:\n"); printTheme(oggTheme); hexchat_printf(ph,"\nTitle-Theme:\n"); printTheme(titleTheme); }
static int print_uptime (int announce, char* format) { char buffer[bsize]; int weeks; int days; int hours; int minutes; int seconds; if (xs_parse_uptime (&weeks, &days, &hours, &minutes, &seconds)) { hexchat_printf (ph, "%s\tERROR in parse_uptime()", name); return HEXCHAT_EAT_ALL; } if (minutes != 0 || hours != 0 || days != 0 || weeks != 0) { if (hours != 0 || days != 0 || weeks != 0) { if (days !=0 || weeks != 0) { if (weeks != 0) { snprintf (buffer, bsize, "%dw %dd %dh %dm %ds", weeks, days, hours, minutes, seconds); } else { snprintf (buffer, bsize, "%dd %dh %dm %ds", days, hours, minutes, seconds); } } else { snprintf (buffer, bsize, "%dh %dm %ds", hours, minutes, seconds); } } else { snprintf (buffer, bsize, "%dm %ds", minutes, seconds); } } format_output ("Uptime", buffer, format); if (announce) { hexchat_commandf (ph, "SAY %s", buffer); } else { hexchat_printf (ph, "%s", buffer); } return HEXCHAT_EAT_ALL; }
struct tagInfo readID3V1(char *file){ //if (DEBUG==1) putlog("reading ID3V1"); FILE *f; struct tagInfo ret; int res, i, c, val; char *tag; char *id; char *tmp; tag = (char*) malloc(sizeof(char)*129); ret.artist=NULL; f=fopen(file,"rb"); if (f==NULL){ hexchat_print(ph,"file not found while trying to read id3v1"); //if (DEBUG==1) putlog("file not found while trying to read id3v1"); return ret; } //int offset=getSize(file)-128; res=fseek(f,-128,SEEK_END); if (res!=0) {printf("seek failed\n");fclose(f);return ret;} //long int pos=ftell(f); //printf("position= %li\n",pos); for (i=0;i<128;i++) { c=fgetc(f); if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;} tag[i]=(char)c; } fclose(f); //printf("tag readed: \n"); id=substring(tag,0,3); //printf("header: %s\n",id); if (strcmp(id,"TAG")!=0){hexchat_printf(ph,"no id3 v1 found\n");return ret;} ret.title=subString(tag,3,30,1); ret.artist=subString(tag,33,30,1); ret.album=subString(tag,63,30,1); ret.comment=subString(tag,97,30,1); tmp=substring(tag,127,1); //ret.genre=substring(tag,127,1); val=(int)tmp[0]; if (val<0)val+=256; //hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); if ((val<148)&&(val>=0)) ret.genre=GENRES[val];//#############changed else { ret.genre="unknown"; //hexchat_printf(ph, "tmp[0]=%i (%i)",val,tmp[0]); } //hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]); //hexchat_printf(ph,"genre \"%s\"",ret.genre); //if (DEBUG==1) putlog("id3v1 extracted"); return ret; }
static script_info *create_script(char const *file) { int base; char *filename_fs; lua_State *L; script_info *info = g_new0(script_info, 1); info->hooks = g_ptr_array_new_with_free_func((GDestroyNotify)free_hook); info->unload_hooks = g_ptr_array_new_with_free_func((GDestroyNotify)free_hook); info->filename = g_strdup(expand_path(file)); L = luaL_newstate(); info->state = L; if(!L) { hexchat_print(ph, "\00304Could not allocate memory for the script"); destroy_script(info); return NULL; } prepare_state(L, info); lua_rawgeti(L, LUA_REGISTRYINDEX, info->traceback); base = lua_gettop(L); filename_fs = g_filename_from_utf8(info->filename, -1, NULL, NULL, NULL); if(!filename_fs) { hexchat_printf(ph, "Invalid filename: %s", info->filename); destroy_script(info); return NULL; } if(luaL_loadfile(L, filename_fs)) { g_free(filename_fs); hexchat_printf(ph, "Lua syntax error: %s", luaL_optstring(L, -1, "")); destroy_script(info); return NULL; } g_free(filename_fs); info->status |= STATUS_ACTIVE; if(lua_pcall(L, 0, 0, base)) { char const *error = lua_tostring(L, -1); hexchat_printf(ph, "Lua error: %s", error ? error : "(non-string error)"); destroy_script(info); return NULL; } lua_pop(L, 1); if(!info->name) { hexchat_printf(ph, "Lua script didn't register with hexchat.register"); destroy_script(info); return NULL; } return info; }
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; }
void CWMPADialog::OnDblclkPlaylist() { // TODO: Add your control notification handler code here long index; // Get the playlist name index = m_PlaylistBox.GetCurSel(); CString playlistName; m_PlaylistBox.GetText(index, playlistName); // Get the playlist CWMPPlaylistCollection pc = m_WMP.GetPlaylistCollection(); CWMPPlaylistArray pa = pc.getByName((LPCTSTR) playlistName); CWMPPlaylist playlist = pa.Item(0); m_WMP.SetCurrentPlaylist(playlist); // Set the song list UpdateSongList(); m_WMP.GetControls().play(); if (autoAnnounce) { hexchat_commandf(ph, "me is playing %s", (LPCTSTR) wmpaGetSongTitle()); } else { hexchat_printf(ph, "WMPA: Playing %s", (LPCTSTR) wmpaGetSongTitle()); } }
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 hexchat_plugin_deinit (void) { hexchat_command (ph, "MENU DEL \"Window/Display System Info\""); hexchat_printf (ph, "%s plugin unloaded\n", name); return 1; }
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; }
/** * 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) { 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_deinit (void) { hexchat_command (ph, "MENU DEL \"Help/Check for updates\""); hexchat_printf (ph, "%s plugin unloaded\n", name); return 1; }
static void identd_start_server (void) { GError *error = NULL; int enabled, port = 113; if (hexchat_get_prefs (ph, "identd_server", NULL, &enabled) == 3) { if (!enabled) return; } if (hexchat_get_prefs (ph, "identd_port", NULL, &port) == 2 && (port <= 0 || port > G_MAXUINT16)) { port = 113; } service = g_socket_service_new (); g_socket_listener_add_inet_port (G_SOCKET_LISTENER (service), port, NULL, &error); if (error) { hexchat_printf (ph, _("*\tError starting identd server: %s"), error->message); g_error_free (error); g_clear_object (&service); return; } /*hexchat_printf (ph, "*\tIdentd listening on port: %d", port); */ g_signal_connect (G_OBJECT (service), "incoming", G_CALLBACK(identd_incoming_cb), NULL); g_socket_service_start (service); }
static int print_cpu (int announce, char* format) { char model[bsize]; char vendor[bsize]; char cache[bsize]; char buffer[bsize]; unsigned int count; double freq; int giga = 0; if (xs_parse_cpu (model, vendor, &freq, cache, &count) != 0) { hexchat_printf (ph, "%s\tERROR in parse_cpu()", name); return HEXCHAT_EAT_ALL; } if (freq > 1000) { freq /= 1000; giga = 1; } if (giga) { snprintf (buffer, bsize, "%d x %s (%s) @ %.2fGHz w/ %s L2 Cache", count, model, vendor, freq, cache); } else { snprintf (buffer, bsize, "%d x %s (%s) @ %.0fMHz w/ %s L2 Cache", count, model, vendor, freq, cache); } format_output ("CPU", buffer, format); if (announce) { hexchat_commandf (ph, "SAY %s", buffer); } else { hexchat_printf (ph, "%s", buffer); } return HEXCHAT_EAT_ALL; }
static void list_settings () { char list[512]; char buffer[512]; char* token; hexchat_pluginpref_list (ph, list); hexchat_printf (ph, "%s\tCurrent Settings:", name); token = strtok (list, ","); while (token != NULL) { hexchat_pluginpref_get_str (ph, token, buffer); hexchat_printf (ph, "%s\t%s: %s\n", name, token, buffer); token = strtok (NULL, ","); } }
static int fd_cb (int fd, int flags, void *userdata) { HookData *data = (HookData *) userdata; int retVal = 0; int count = 0; dSP; ENTER; SAVETMPS; PUSHMARK (SP); XPUSHs (data->userdata); PUTBACK; set_current_package (data->package); count = call_sv (data->callback, G_EVAL); set_current_package (&PL_sv_undef); SPAGAIN; if (SvTRUE (ERRSV)) { hexchat_printf (ph, "Error in fd callback %s", SvPV_nolen (ERRSV)); if (!SvOK (POPs)) {} /* remove undef from the top of the stack */ retVal = HEXCHAT_EAT_ALL; } else { if (count != 1) { hexchat_print (ph, "Fd handler should only return 1 value."); retVal = HEXCHAT_EAT_NONE; } else { retVal = POPi; if (retVal == 0) { /* if 0 is returned, the fd is going to get unhooked */ PUSHMARK (SP); XPUSHs (sv_2mortal (newSViv (PTR2IV (data->hook)))); PUTBACK; call_pv ("Xchat::unhook", G_EVAL); SPAGAIN; SvREFCNT_dec (data->callback); if (data->userdata) { SvREFCNT_dec (data->userdata); } free (data); } } } PUTBACK; FREETMPS; LEAVE; return retVal; }
static int print_disk (int announce, char* format) { char string[bsize] = {0,}; #if 0 if (*word == '\0') { if (xs_parse_df (NULL, string)) { hexchat_printf (ph, "ERROR in parse_df"); return HEXCHAT_EAT_ALL; } } else { if (xs_parse_df (*word, string)) { hexchat_printf (ph, "ERROR in parse_df"); return HEXCHAT_EAT_ALL; } } #endif if (xs_parse_df (NULL, string)) { hexchat_printf (ph, "%s\tERROR in parse_df", name); return HEXCHAT_EAT_ALL; } format_output ("Disk", string, format); if (announce) { hexchat_commandf (ph, "SAY %s", string); } else { hexchat_printf (ph, "%s", string); } return HEXCHAT_EAT_ALL; }
static int print_version_quiet (void *userdata) { char *version = check_version (); /* if it's not the current version AND not network error */ if (!(strcmp (version, hexchat_get_info (ph, "version")) == 0) && !(strcmp (version, "Unknown") == 0)) { #ifdef _WIN64 /* use this approach, the wProcessorArchitecture method always returns 0 (=x86) for plugins for some reason */ hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x64.exe\n", name, version); #else hexchat_printf (ph, "%s\tA HexChat update is available! You can download it from here:\nhttps://github.com/downloads/hexchat/hexchat/HexChat%%20%s%%20x86.exe\n", name, version); #endif /* print update url once, then stop the timer */ return 0; } /* keep checking */ return 1; }
/** * Command handler for /delkey */ static int handle_delkey(char *word[], char *word_eol[], void *userdata) { const char *nick; // Check syntax if (*word[2] == '\0' || *word[3] != '\0') { hexchat_printf(ph, "%s\n", usage_delkey); return HEXCHAT_EAT_HEXCHAT; } nick = word[2]; // Delete the given nick from the key store if (keystore_delete_nick(nick)) { hexchat_printf(ph, "Deleted key for %s\n", nick); } else { hexchat_printf(ph, "\00305Failed to delete key in blow.ini!\n", nick); } return HEXCHAT_EAT_HEXCHAT; }
void sysinfo_print_error (const char* msg) { if (!error_printed) { hexchat_printf (ph, "%s\t%s", name, msg); } error_printed++; }
static int dccrecv_cb (char *word[], void *userdata) { int result; struct stat buffer; /* buffer for storing file info */ char sum[65]; /* buffer for checksum */ const char *file; char *cfile; if (hexchat_get_prefs (ph, "dcc_completed_dir", &file, NULL) == 1 && file[0] != 0) { cfile = g_strconcat (file, G_DIR_SEPARATOR_S, word[1], NULL); } else { cfile = g_strdup(word[2]); } result = stat (cfile, &buffer); if (result == 0) /* stat returns 0 on success */ { if (buffer.st_size <= (unsigned long long) get_limit () * 1048576) { sha256_file (cfile, sum); /* file is the full filename even if completed dir set */ /* try to print the checksum in the privmsg tab of the sender */ hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3])); hexchat_printf (ph, "SHA-256 checksum for %s (local): %s\n", word[1], sum); } else { hexchat_set_context (ph, hexchat_find_context (ph, NULL, word[3])); hexchat_printf (ph, "SHA-256 checksum for %s (local): (size limit reached, no checksum calculated, you can increase it with /CHECKSUM INC)\n", word[1]); } } else { hexchat_printf (ph, "File access error!\n"); } g_free (cfile); return HEXCHAT_EAT_NONE; }
/** * Command handler for /delkey */ static int handle_delkey(char *word[], char *word_eol[], void *userdata) { const char *nick; /* Check syntax */ if (*word[2] == '\0' || *word[3] != '\0') { hexchat_printf(ph, "%s\n", usage_delkey); return HEXCHAT_EAT_HEXCHAT; } nick = g_strstrip (word_eol[2]); /* Delete the given nick from the key store */ if (keystore_delete_nick(nick)) { hexchat_printf(ph, "Deleted key for %s\n", nick); } else { hexchat_printf(ph, "\00305Failed to delete key in addon_fishlim.conf!\n"); } return HEXCHAT_EAT_HEXCHAT; }
static int connect_cb (char *word[], void *userdata) { if (get_info ()) { hexchat_printf (ph, "%s\tSASL enabled\n", name); hexchat_commandf (ph, "QUOTE CAP REQ :sasl"); } return HEXCHAT_EAT_NONE; }
static int checksum (char *word[], char *word_eol[], void *userdata) { if (!g_ascii_strcasecmp ("GET", word[2])) { print_limit (); } else if (!g_ascii_strcasecmp ("SET", word[2])) { set_limit (word[3]); } else { hexchat_printf (ph, "Usage: /CHECKSUM GET|SET\n"); hexchat_printf (ph, " GET - print the maximum file size (in MiB) to be hashed\n"); hexchat_printf (ph, " SET <filesize> - set the maximum file size (in MiB) to be hashed\n"); } return HEXCHAT_EAT_NONE; }