summary refs log tree commit diff stats
path: root/plugins
AgeCommit message (Expand)Author
2011-11-30plugin config - separate string and int functionsBerke Viktor
2011-11-30use global xchat-plugin.h for xtrayBerke Viktor
2011-11-30plugin config save is done via raw file access, now works with multiple varsBerke Viktor
2011-11-29initial plugin config framework, can't save multiple entriesBerke Viktor
2011-11-29display sysinfo for self when not in channel/dialogBerke Viktor
2011-11-29own icon for winsysBerke Viktor
2011-11-29relicense own plugins under the MIT licenseBerke Viktor
2011-11-29winsys cosmetics and extensionsBerke Viktor
2011-11-28MSVC-style printBerke Viktor
2011-11-28fix winsys freezeBerke Viktor
2011-11-28now winsys actually works as a pluginBerke Viktor
2011-11-28enable building of winsys with other pluginsBerke Viktor
2011-11-28more winsys fixes and build as c++Berke Viktor
2011-11-28more winsys fixes for wdkBerke Viktor
2011-11-28installer support for obs and gtk engines, x64 supportBerke Viktor
2011-11-28first piece of wdk fixes for winsysBerke Viktor
2011-11-27initial version of winsys sysinfo pluginBerke Viktor
2011-11-27fix the update checker, return correctly with callbackBerke Viktor
2011-11-27some formatting for execBerke Viktor
2011-11-27make exec display as nice as possibleBerke Viktor
2011-11-27exec cleanupBerke Viktor
2011-11-27exec support for releaser and makefileBerke Viktor
2011-11-27initial execBerke Viktor
2011-11-25perform periodic update checks automaticallyBerke Viktor
2011-11-25rename fishlim main file in makefile tooBerke Viktor
2011-11-25get in sync with fishlim upstreamBerke Viktor
2011-11-25rename fishlim main file to avoid confusionBerke Viktor
2011-11-24fix fishlim config handlerBerke Viktor
2011-11-24add fishlim pluginBerke Viktor
2011-11-23forgot to bump updater version numberBerke Viktor
2011-11-23Merge branch 'master' into wdkBerke Viktor
2011-11-23update xchat to r1498Berke Viktor
2011-11-23fix update checker for separate installersBerke Viktor
2011-11-22add doat pluginBerke Viktor
2011-11-22gtk engines are non-existent in gtk.org buildsBerke Viktor
2011-08-18omit gtkpref messagesBerke Viktor
2011-08-17working gtkpref pluginBerke Viktor
2011-08-17skeleton for gtkpref launcher pluginBerke Viktor
2011-08-12replace 16x16 WMP icon with 32x32 one for Win7 taskbarBerke Viktor
2011-08-12add info about WMP iconBerke Viktor
2011-08-12add wmpa pluginBerke Viktor
2011-08-12add wmpa 1.0.2 sourcesBerke Viktor
2011-08-11minor formattingBerke Viktor
2011-08-09include channel name in channel message and channel msg hilight event alerts ...Berke Viktor
2011-08-09do not cache update infoBerke Viktor
2011-08-09update the update checker to use our shiny new git repoBerke Viktor
2011-07-28instruct users to download strawberry perl instead of activeperlberkeviktor@aol.com
2011-07-28fix perl 5.14 linkageberkeviktor@aol.com
2011-07-28polish the building process of the perl interfaceberkeviktor@aol.com
2011-07-27fix xtray keyboard shortcut handlingberkeviktor@aol.com
-Sys * Copyright (C) 2005, 2006, 2007 Tony Vroon * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <unistd.h> #include "xsys.h" float percentage(unsigned long long *free, unsigned long long *total) { unsigned long long result = (*free) * (unsigned long long)1000 / (*total); return result / 10.0; } char *pretty_freespace(const char *desc, unsigned long long *free_k, unsigned long long *total_k) { char *result, *bytesize; double free_space, total_space; free_space = *free_k; total_space = *total_k; result = malloc(bsize * sizeof(char)); bytesize = malloc(3 * sizeof(char)); const char *quantities = "KB\0MB\0GB\0TB\0PB\0EB\0ZB\0YB\0"; int i=0; if (total_space == 0) { snprintf(result, bsize, "%s: none", desc); return result; } while (total_space > 1023 && i <= 14) { i=i+3; *bytesize=*(quantities+i); *(bytesize+1)=*(quantities+i+1); *(bytesize+2)=*(quantities+i+2); free_space = free_space / 1024; total_space = total_space / 1024; } if (sysinfo_get_percent () != 0) snprintf(result, bsize, "%s: %.1f%s, %.1f%% free", desc, total_space, bytesize, percentage(free_k, total_k)); else snprintf(result, bsize, "%s: %.1f%s/%.1f%s free", desc, free_space, bytesize, total_space, bytesize); return result; } void remove_leading_whitespace(char *buffer) { char *pos; while((pos = memchr(buffer, 0x20, 1))) { pos += 1; strcpy(buffer, pos); } } char *decruft_filename(char *buffer) { char *match, *match_end; while ((match = strstr(buffer, "%20"))) { match_end = match + 3; *match++ = ' '; while (*match_end) *match++ = *match_end++; *match = 0; } return buffer; } void find_match_char(char *buffer, char *match, char *result) { char *position; remove_leading_whitespace(buffer); if(strstr(buffer, match) == strstr(buffer, buffer)) { position = strpbrk(buffer, delims); if (position != NULL) { position += 1; strcpy(result, position); position = strstr(result, "\n"); *(position) = '\0'; remove_leading_whitespace(result); } else strcpy(result, "\0"); } } void find_match_double(char *buffer, char *match, double *result) { char *position; remove_leading_whitespace(buffer); if(strstr(buffer, match) == strstr(buffer, buffer)) { position = strpbrk(buffer, delims); if (position != NULL) { position += 1; *result = strtod(position, NULL); } else *result = 0; } } void find_match_double_hex(char *buffer, char *match, double *result) { char *position; remove_leading_whitespace(buffer); if(strstr(buffer, match) == strstr(buffer, buffer)) { position = strpbrk(buffer, delims); if (position != NULL) { memcpy(position,"0x",2); *result = strtod(position,NULL); } else *result = 0; } } void find_match_int(char *buffer, char *match, unsigned int *result) { char *position; remove_leading_whitespace(buffer); if(strstr(buffer, match) == strstr(buffer, buffer)) { position = strpbrk(buffer, delims); if (position != NULL) { position += 1; *result = atoi(position); } else *result = 0; } } void find_match_ll(char *buffer, char *match, unsigned long long *result) { char *position; remove_leading_whitespace(buffer); if(strstr(buffer, match) == strstr(buffer, buffer)) { position = strpbrk(buffer, delims); if (position != NULL) { position += 1; *result = strtoll(position, NULL, 10); } else *result = 0; } } void format_output(const char *arg, char *string, char *format) { char *pos1, *pos2, buffer[bsize]; pos1 = &format[0]; strncpy(buffer, string, bsize); string[0] = '\0'; while((pos2 = strstr(pos1, "%")) != NULL) { strncat(string, pos1, (size_t)(pos2-pos1)); if(*(pos2+1) == '1') strcat(string, arg); else if(*(pos2+1) == '2') strcat(string, buffer); else if(*(pos2+1) == 'C' || *(pos2+1) == 'c') strcat(string, "\003"); else if(*(pos2+1) == 'B' || *(pos2+1) == 'b') strcat(string, "\002"); else if(*(pos2+1) == 'R' || *(pos2+1) == 'r') strcat(string, "\026"); else if(*(pos2+1) == 'O' || *(pos2+1) == 'o') strcat(string, "\017"); else if(*(pos2+1) == 'U' || *(pos2+1) == 'u') strcat(string, "\037"); else if(*(pos2+1) == '%') strcat(string, "%"); pos1=pos2+2; } strcat(string, pos1); } void flat_format_output(const char *arg, char *string, char *format) { char *pos1, *pos2, buffer[bsize]; pos1 = &format[0]; strncpy(buffer, string, bsize); string[0] = '\0'; while((pos2 = strstr(pos1, "%")) != NULL) { strncat(string, pos1, (size_t)(pos2-pos1)); if(*(pos2+1) == '1') strcat(string, arg); else if(*(pos2+1) == '2') strcat(string, buffer); else if(*(pos2+1) == '%') strcat(string, "%"); pos1=pos2+2; } strcat(string, pos1); }