2012-10-21 06:44:29 +02:00
/*
2012-10-21 14:24:01 +02:00
* SysInfo - sysinfo plugin for HexChat
* Copyright ( c ) 2012 Berke Viktor .
*
2012-10-21 06:44:29 +02:00
* xsys . c - main functions for X - Sys 2
* by mikeshoup
* Copyright ( C ) 2003 , 2004 , 2005 Michael Shoup
* 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
2012-12-23 20:36:54 +01:00
* Foundation , Inc . , 51 Franklin St , Fifth Floor , Boston , MA 02110 - 1301 , USA
2012-10-21 06:44:29 +02:00
*/
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
2012-10-21 12:15:41 +02:00
# include <glib.h>
2012-10-21 06:44:29 +02:00
2012-10-24 21:33:02 +02:00
# include "hexchat-plugin.h"
2012-10-21 06:44:29 +02:00
# include "parse.h"
# include "match.h"
# include "xsys.h"
2012-10-21 09:56:09 +02:00
# define DEFAULT_FORMAT "%B%1:%B %2 **"
2012-10-21 14:24:01 +02:00
# define DEFAULT_PERCENT 1
2013-08-26 10:31:45 +02:00
# define DEFAULT_ANNOUNCE 1
2012-10-21 09:56:09 +02:00
# define DEFAULT_PCIIDS " / usr / share / hwdata / pci.ids"
2012-10-30 08:42:48 +01:00
static hexchat_plugin * ph ; /* plugin handle */
2012-10-21 14:24:01 +02:00
static int error_printed = 0 ; /* semaphore, make sure not to print the same error more than once during one execution */
2012-10-21 06:44:29 +02:00
2012-10-21 07:15:48 +02:00
static char name [ ] = " SysInfo " ;
static char desc [ ] = " Display info about your hardware and OS " ;
2012-10-21 14:24:01 +02:00
static char version [ ] = " 3.0 " ;
2013-08-26 10:31:45 +02:00
static char sysinfo_help [ ] = " SysInfo Usage: \n /SYSINFO [-e|-o] [OS|DISTRO|CPU|RAM|DISK|VGA|SOUND|ETHERNET|UPTIME], print various details about your system or print a summary without arguments \n /SYSINFO LIST, print current settings \n /SYSINFO SET <variable>, update given setting \n /SYSINFO RESET, reset settings to defaults \n /NETDATA <iface>, show transmitted data on given interface \n /NETSTREAM <iface>, show current bandwidth on given interface \n " ;
2012-10-21 06:44:29 +02:00
2012-10-21 12:15:41 +02:00
void
sysinfo_get_pciids ( char * dest )
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_get_str ( ph , " pciids " , dest ) ;
2012-10-21 12:15:41 +02:00
}
int
2012-10-21 14:24:01 +02:00
sysinfo_get_percent ( )
2012-10-21 12:15:41 +02:00
{
2012-10-30 08:42:48 +01:00
return hexchat_pluginpref_get_int ( ph , " percent " ) ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
int
sysinfo_get_announce ( )
{
return hexchat_pluginpref_get_int ( ph , " announce " ) ;
}
2012-10-21 14:24:01 +02:00
void
sysinfo_print_error ( const char * msg )
{
if ( ! error_printed )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t %s " , name , msg ) ;
2012-10-21 14:24:01 +02:00
}
error_printed + + ;
2012-10-21 12:15:41 +02:00
}
2012-10-21 09:56:09 +02:00
static int
2012-10-21 12:15:41 +02:00
print_summary ( int announce , char * format )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
char sysinfo [ bsize ] ;
2012-10-21 06:44:29 +02:00
char buffer [ bsize ] ;
2012-10-21 12:15:41 +02:00
char cpu_model [ bsize ] ;
char cpu_cache [ bsize ] ;
char cpu_vendor [ bsize ] ;
char os_host [ bsize ] ;
char os_user [ bsize ] ;
char os_kernel [ bsize ] ;
unsigned long long mem_total ;
unsigned long long mem_free ;
2012-10-21 06:44:29 +02:00
unsigned int count ;
2012-10-21 12:15:41 +02:00
double cpu_freq ;
2012-10-21 06:44:29 +02:00
int giga = 0 ;
2012-10-21 12:15:41 +02:00
int weeks ;
int days ;
int hours ;
int minutes ;
int seconds ;
sysinfo [ 0 ] = ' \0 ' ;
2012-10-21 06:44:29 +02:00
2012-10-30 08:42:48 +01:00
snprintf ( buffer , bsize , " %s " , hexchat_get_info ( ph , " version " ) ) ;
2012-10-21 12:15:41 +02:00
format_output ( " HexChat " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( sysinfo ) ) ;
/* BEGIN OS PARSING */
if ( xs_parse_os ( os_user , os_host , os_kernel ) ! = 0 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_os() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
snprintf ( buffer , bsize , " %s " , os_kernel ) ;
format_output ( " OS " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( sysinfo ) ) ;
/* BEGIN DISTRO PARSING */
if ( xs_parse_distro ( buffer ) ! = 0 )
{
strncpy ( buffer , " Unknown " , bsize ) ;
}
format_output ( " Distro " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( sysinfo ) ) ;
/* BEGIN CPU PARSING */
if ( xs_parse_cpu ( cpu_model , cpu_vendor , & cpu_freq , cpu_cache , & count ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_cpu() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 12:15:41 +02:00
if ( cpu_freq > 1000 )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
cpu_freq / = 1000 ;
2012-10-21 06:44:29 +02:00
giga = 1 ;
}
2012-10-21 09:56:09 +02:00
if ( giga )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
snprintf ( buffer , bsize , " %d x %s (%s) @ %.2fGHz " , count , cpu_model , cpu_vendor , cpu_freq ) ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
else
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
snprintf ( buffer , bsize , " %d x %s (%s) @ %.0fMHz " , count , cpu_model , cpu_vendor , cpu_freq ) ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
format_output ( " CPU " , buffer , format ) ;
2012-10-21 12:15:41 +02:00
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( sysinfo ) ) ;
2012-10-21 06:44:29 +02:00
2012-10-21 12:15:41 +02:00
/* BEGIN MEMORY PARSING */
if ( xs_parse_meminfo ( & mem_total , & mem_free , 0 ) = = 1 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_meminfo! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 12:15:41 +02:00
snprintf ( buffer , bsize , " %s " , pretty_freespace ( " Physical " , & mem_free , & mem_total ) ) ;
format_output ( " RAM " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( sysinfo ) ) ;
/* BEGIN DISK PARSING */
if ( xs_parse_df ( NULL , buffer ) )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_df " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
format_output ( " Disk " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( buffer ) ) ;
2012-10-21 06:44:29 +02:00
2012-10-21 12:15:41 +02:00
/* BEGIN VIDEO PARSING */
if ( xs_parse_video ( buffer ) )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_video " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
format_output ( " VGA " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( buffer ) ) ;
/* BEGIN SOUND PARSING */
if ( xs_parse_sound ( buffer ) )
{
strncpy ( buffer , " Not present " , bsize ) ;
}
format_output ( " Sound " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( buffer ) ) ;
/* BEGIN ETHERNET PARSING */
if ( xs_parse_ether ( buffer ) )
{
strncpy ( buffer , " None found " , bsize ) ;
}
2012-10-21 14:30:10 +02:00
2012-10-21 12:15:41 +02:00
format_output ( " Ethernet " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( buffer ) ) ;
/* BEGIN UPTIME PARSING */
2012-10-21 09:56:09 +02:00
if ( xs_parse_uptime ( & weeks , & days , & hours , & minutes , & seconds ) )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_uptime() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
if ( minutes ! = 0 | | hours ! = 0 | | days ! = 0 | | weeks ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-21 09:56:09 +02:00
if ( hours ! = 0 | | days ! = 0 | | weeks ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-21 09:56:09 +02:00
if ( days ! = 0 | | weeks ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
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 ) ;
}
}
2012-10-21 06:44:29 +02:00
2012-10-21 12:15:41 +02:00
format_output ( " Uptime " , buffer , format ) ;
strcat ( sysinfo , " \017 " ) ;
strncat ( sysinfo , buffer , bsize - strlen ( buffer ) ) ;
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
if ( announce )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , sysinfo ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 06:44:29 +02:00
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , sysinfo ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
static int
2012-10-21 12:15:41 +02:00
print_os ( int announce , char * format )
2012-10-21 06:44:29 +02:00
{
2012-10-21 09:56:09 +02:00
char buffer [ bsize ] ;
char user [ bsize ] ;
char host [ bsize ] ;
char kernel [ bsize ] ;
if ( xs_parse_os ( user , host , kernel ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_os() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
snprintf ( buffer , bsize , " %s@%s, %s " , user , host , kernel ) ;
format_output ( " OS " , buffer , format ) ;
2012-10-21 06:44:29 +02:00
2012-10-21 12:15:41 +02:00
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , buffer ) ;
2012-10-21 12:15:41 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , buffer ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
static int
print_distro ( int announce , char * format )
{
char name [ bsize ] ;
if ( xs_parse_distro ( name ) ! = 0 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_distro()! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
format_output ( " Distro " , name , format ) ;
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , name ) ;
2012-10-21 12:15:41 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , name ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
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 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_cpu() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
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 )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , buffer ) ;
2012-10-21 12:15:41 +02:00
}
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , buffer ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 12:15:41 +02:00
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
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 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_meminfo! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
if ( xs_parse_meminfo ( & swap_total , & swap_free , 1 ) = = 1 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_meminfo! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
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 )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , string ) ;
2012-10-21 12:15:41 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , string ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
static int
print_disk ( int announce , char * format )
{
char string [ bsize ] = { 0 , } ;
#if 0
if ( * word = = ' \0 ' )
{
if ( xs_parse_df ( NULL , string ) )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " ERROR in parse_df " ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
}
else
{
if ( xs_parse_df ( * word , string ) )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " ERROR in parse_df " ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
}
# endif
if ( xs_parse_df ( NULL , string ) )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_df " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
format_output ( " Disk " , string , format ) ;
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , string ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-21 06:44:29 +02:00
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , string ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
static int
2012-10-21 12:15:41 +02:00
print_vga ( int announce , char * format )
{
char vid_card [ bsize ] ;
char agp_bridge [ bsize ] ;
char buffer [ bsize ] ;
int ret ;
if ( ( ret = xs_parse_video ( vid_card ) ) ! = 0 )
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_video! %d " , name , ret ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
if ( xs_parse_agpbridge ( agp_bridge ) ! = 0 )
{
snprintf ( buffer , bsize , " %s " , vid_card ) ;
}
else
{
snprintf ( buffer , bsize , " %s @ %s " , vid_card , agp_bridge ) ;
}
format_output ( " VGA " , buffer , format ) ;
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , buffer ) ;
2012-10-21 12:15:41 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , buffer ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
static int
print_sound ( int announce , char * format )
2012-10-21 06:44:29 +02:00
{
char sound [ bsize ] ;
2012-10-21 09:56:09 +02:00
if ( xs_parse_sound ( sound ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_asound()! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
format_output ( " Sound " , sound , format ) ;
2012-10-21 12:15:41 +02:00
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , sound ) ;
2012-10-21 12:15:41 +02:00
}
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , sound ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 12:15:41 +02:00
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
static int
print_ethernet ( int announce , char * format )
{
char ethernet_card [ bsize ] ;
if ( xs_parse_ether ( ethernet_card ) )
{
strncpy ( ethernet_card , " None found " , bsize ) ;
}
format_output ( " Ethernet " , ethernet_card , format ) ;
if ( announce )
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , ethernet_card ) ;
2012-10-21 12:15:41 +02:00
}
2012-10-21 06:44:29 +02:00
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , ethernet_card ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
static int
2012-10-21 12:15:41 +02:00
print_uptime ( int announce , char * format )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
char buffer [ bsize ] ;
int weeks ;
int days ;
int hours ;
int minutes ;
int seconds ;
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
if ( xs_parse_uptime ( & weeks , & days , & hours , & minutes , & seconds ) )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_uptime() " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
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 ) ;
}
}
2012-10-21 09:56:09 +02:00
2012-10-21 12:15:41 +02:00
format_output ( " Uptime " , buffer , format ) ;
if ( announce )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , buffer ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 06:44:29 +02:00
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , buffer ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 12:15:41 +02:00
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 12:15:41 +02:00
}
2012-10-21 06:44:29 +02:00
2012-10-21 09:56:09 +02:00
static int
netdata_cb ( char * word [ ] , char * word_eol [ ] , void * userdata )
2012-10-21 06:44:29 +02:00
{
char netdata [ bsize ] ;
2012-10-21 09:56:09 +02:00
char format [ bsize ] ;
unsigned long long bytes_recv ;
unsigned long long bytes_sent ;
2012-10-21 06:44:29 +02:00
2012-10-21 09:56:09 +02:00
if ( * word [ 2 ] = = ' \0 ' )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t You must specify a network device (e.g. /NETDATA eth0)! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
if ( xs_parse_netdev ( word [ 2 ] , & bytes_recv , & bytes_sent ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_netdev " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
2012-10-21 06:44:29 +02:00
bytes_recv / = 1024 ;
bytes_sent / = 1024 ;
2013-10-05 18:26:55 +02:00
snprintf ( netdata , bsize , " %s: %.1f MB Received, %.1f MB Sent " , word [ 2 ] , ( double ) bytes_recv / 1024.0 , ( double ) bytes_sent / 1024.0 ) ;
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_get_str ( ph , " format " , format ) ;
2012-10-21 09:56:09 +02:00
format_output ( " Netdata " , netdata , format ) ;
2012-10-30 08:42:48 +01:00
if ( hexchat_list_int ( ph , NULL , " type " ) > = 2 )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , netdata ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 06:44:29 +02:00
else
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , netdata ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
static int
netstream_cb ( char * word [ ] , char * word_eol [ ] , void * userdata )
2012-10-21 06:44:29 +02:00
{
2012-10-21 09:56:09 +02:00
char netstream [ bsize ] ;
2012-10-26 14:44:46 +02:00
char mag_r [ 5 ] ;
2012-10-21 09:56:09 +02:00
char mag_s [ 5 ] ;
char format [ bsize ] ;
unsigned long long bytes_recv ;
unsigned long long bytes_sent ;
unsigned long long bytes_recv_p ;
unsigned long long bytes_sent_p ;
2012-10-21 06:44:29 +02:00
struct timespec ts = { 1 , 0 } ;
2012-10-21 09:56:09 +02:00
if ( * word [ 2 ] = = ' \0 ' )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t You must specify a network device (e.g. /NETSTREAM eth0)! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
if ( xs_parse_netdev ( word [ 2 ] , & bytes_recv , & bytes_sent ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_netdev " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
while ( nanosleep ( & ts , & ts ) < 0 ) ;
if ( xs_parse_netdev ( word [ 2 ] , & bytes_recv_p , & bytes_sent_p ) ! = 0 )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t ERROR in parse_netdev " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
2012-10-21 06:44:29 +02:00
bytes_recv = ( bytes_recv_p - bytes_recv ) ;
bytes_sent = ( bytes_sent_p - bytes_sent ) ;
2012-10-21 09:56:09 +02:00
if ( bytes_recv > 1024 )
2012-10-21 06:44:29 +02:00
{
bytes_recv / = 1024 ;
2012-10-21 09:56:09 +02:00
snprintf ( mag_r , 5 , " KB/s " ) ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
else
{
snprintf ( mag_r , 5 , " B/s " ) ;
}
if ( bytes_sent > 1024 )
2012-10-21 06:44:29 +02:00
{
bytes_sent / = 1024 ;
2012-10-21 09:56:09 +02:00
snprintf ( mag_s , 5 , " KB/s " ) ;
2012-10-21 06:44:29 +02:00
}
else
2012-10-21 09:56:09 +02:00
{
snprintf ( mag_s , 5 , " B/s " ) ;
}
snprintf ( netstream , bsize , " %s: Receiving %llu %s, Sending %llu %s " , word [ 2 ] , bytes_recv , mag_r , bytes_sent , mag_s ) ;
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_get_str ( ph , " format " , format ) ;
2012-10-21 09:56:09 +02:00
format_output ( " Netstream " , netstream , format ) ;
2012-10-30 08:42:48 +01:00
if ( hexchat_list_int ( ph , NULL , " type " ) > = 2 )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_commandf ( ph , " SAY %s " , netstream ) ;
2012-10-21 09:56:09 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s " , netstream ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 14:24:01 +02:00
static void
list_settings ( )
{
char list [ 512 ] ;
char buffer [ 512 ] ;
char * token ;
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_list ( ph , list ) ;
hexchat_printf ( ph , " %s \t Current Settings: " , name ) ;
2012-10-21 14:24:01 +02:00
token = strtok ( list , " , " ) ;
while ( token ! = NULL )
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_get_str ( ph , token , buffer ) ;
hexchat_printf ( ph , " %s \t %s: %s \n " , name , token , buffer ) ;
2012-10-21 14:24:01 +02:00
token = strtok ( NULL , " , " ) ;
}
}
static void
reset_settings ( )
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_set_str ( ph , " pciids " , DEFAULT_PCIIDS ) ;
hexchat_pluginpref_set_str ( ph , " format " , DEFAULT_FORMAT ) ;
hexchat_pluginpref_set_int ( ph , " percent " , DEFAULT_PERCENT ) ;
2013-08-26 10:31:45 +02:00
hexchat_pluginpref_set_int ( ph , " announce " , DEFAULT_ANNOUNCE ) ;
2012-10-21 14:24:01 +02:00
}
2012-10-21 09:56:09 +02:00
static int
2012-10-21 12:15:41 +02:00
sysinfo_cb ( char * word [ ] , char * word_eol [ ] , void * userdata )
2012-10-21 06:44:29 +02:00
{
2012-10-21 14:24:01 +02:00
error_printed = 0 ;
2013-08-26 10:31:45 +02:00
int announce = sysinfo_get_announce ( ) ;
int offset = 0 ;
2012-10-21 14:24:01 +02:00
int buffer ;
2012-10-21 09:56:09 +02:00
char format [ bsize ] ;
2012-10-30 08:42:48 +01:00
if ( ! hexchat_pluginpref_get_str ( ph , " format " , format ) )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t Error reading config file! " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
2013-08-26 10:31:45 +02:00
/* Cannot send to server tab */
if ( hexchat_list_int ( ph , NULL , " type " ) = = 1 )
{
announce = 0 ;
}
/* Allow overriding global announce setting */
if ( ! strcmp ( " -e " , word [ 2 ] ) )
{
announce = 0 ;
offset + + ;
}
else if ( ! strcmp ( " -o " , word [ 2 ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
announce = 1 ;
2013-08-26 10:31:45 +02:00
offset + + ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
if ( ! g_ascii_strcasecmp ( " HELP " , word [ 2 + offset ] ) )
2012-10-21 06:44:29 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , sysinfo_help ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " LIST " , word [ 2 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
list_settings ( ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " SET " , word [ 2 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
2013-08-26 10:31:45 +02:00
if ( ! g_ascii_strcasecmp ( " " , word_eol [ 4 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t Enter a value! \n " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
if ( ! g_ascii_strcasecmp ( " format " , word [ 3 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
2013-08-26 10:31:45 +02:00
hexchat_pluginpref_set_str ( ph , " format " , word_eol [ 4 + offset ] ) ;
hexchat_printf ( ph , " %s \t format is set to: %s \n " , name , word_eol [ 4 + offset ] ) ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " percent " , word [ 3 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
2013-08-26 10:31:45 +02:00
buffer = atoi ( word [ 4 + offset ] ) ; /* don't use word_eol, numbers must not contain spaces */
2012-10-21 14:24:01 +02:00
if ( buffer > 0 & & buffer < INT_MAX )
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_set_int ( ph , " percent " , buffer ) ;
hexchat_printf ( ph , " %s \t percent is set to: %d \n " , name , buffer ) ;
2012-10-21 14:24:01 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t Invalid input! \n " , name ) ;
2012-10-21 14:24:01 +02:00
}
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " announce " , word [ 3 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
2013-08-26 10:31:45 +02:00
buffer = atoi ( word [ 4 + offset ] ) ; /* don't use word_eol, numbers must not contain spaces */
if ( buffer > 0 )
{
hexchat_pluginpref_set_int ( ph , " announce " , 1 ) ;
hexchat_printf ( ph , " %s \t announce is set to: On \n " , name ) ;
}
else
{
hexchat_pluginpref_set_int ( ph , " announce " , 0 ) ;
hexchat_printf ( ph , " %s \t announce is set to: Off \n " , name ) ;
}
}
else if ( ! g_ascii_strcasecmp ( " pciids " , word [ 3 + offset ] ) )
{
hexchat_pluginpref_set_str ( ph , " pciids " , word_eol [ 4 + offset ] ) ;
hexchat_printf ( ph , " %s \t pciids is set to: %s \n " , name , word_eol [ 4 + offset ] ) ;
2012-10-21 14:24:01 +02:00
}
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t Invalid variable name! Use 'pciids', 'format' or 'percent'! \n " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " RESET " , word [ 2 + offset ] ) )
2012-10-21 14:24:01 +02:00
{
reset_settings ( ) ;
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s \t Settings have been restored to defaults. \n " , name ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " OS " , word [ 2 + offset ] ) )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
print_os ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " DISTRO " , word [ 2 + offset ] ) )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
print_distro ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " CPU " , word [ 2 + offset ] ) )
2012-10-21 06:44:29 +02:00
{
2012-10-21 12:15:41 +02:00
print_cpu ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 06:44:29 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " RAM " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_ram ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " DISK " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_disk ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " VGA " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_vga ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " SOUND " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_sound ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " ETHERNET " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_ethernet ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " UPTIME " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_uptime ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
else if ( ! g_ascii_strcasecmp ( " " , word [ 2 + offset ] ) )
2012-10-21 09:56:09 +02:00
{
2012-10-21 12:15:41 +02:00
print_summary ( announce , format ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 09:56:09 +02:00
}
2012-10-21 14:24:01 +02:00
else
{
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , sysinfo_help ) ;
2012-10-30 07:40:37 +01:00
return HEXCHAT_EAT_ALL ;
2012-10-21 14:24:01 +02:00
}
2012-10-21 06:44:29 +02:00
}
2012-10-21 09:56:09 +02:00
int
2012-10-30 08:42:48 +01:00
hexchat_plugin_init ( hexchat_plugin * plugin_handle , char * * plugin_name , char * * plugin_desc , char * * plugin_version , char * arg )
2012-10-21 09:56:09 +02:00
{
ph = plugin_handle ;
* plugin_name = name ;
* plugin_desc = desc ;
* plugin_version = version ;
char buffer [ bsize ] ;
2012-10-30 08:42:48 +01:00
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 ) ;
2012-10-21 09:56:09 +02:00
/* this is required for the very first run */
2012-10-30 08:42:48 +01:00
if ( hexchat_pluginpref_get_str ( ph , " pciids " , buffer ) = = 0 )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_set_str ( ph , " pciids " , DEFAULT_PCIIDS ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 08:42:48 +01:00
if ( hexchat_pluginpref_get_str ( ph , " format " , buffer ) = = 0 )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_set_str ( ph , " format " , DEFAULT_FORMAT ) ;
2012-10-21 09:56:09 +02:00
}
2012-10-30 08:42:48 +01:00
if ( hexchat_pluginpref_get_int ( ph , " percent " ) = = - 1 )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_pluginpref_set_int ( ph , " percent " , DEFAULT_PERCENT ) ;
2012-10-21 09:56:09 +02:00
}
2013-08-26 10:31:45 +02:00
if ( hexchat_pluginpref_get_int ( ph , " announce " ) = = - 1 )
{
hexchat_pluginpref_set_int ( ph , " announce " , DEFAULT_ANNOUNCE ) ;
}
2013-06-02 01:06:58 +02:00
hexchat_command ( ph , " MENU ADD \" Window/Send System Info \" \" SYSINFO \" " ) ;
2012-10-30 08:42:48 +01:00
hexchat_printf ( ph , " %s plugin loaded \n " , name ) ;
2012-10-21 09:56:09 +02:00
return 1 ;
}
int
2012-10-30 08:42:48 +01:00
hexchat_plugin_deinit ( void )
2012-10-21 09:56:09 +02:00
{
2012-10-30 08:42:48 +01:00
hexchat_command ( ph , " MENU DEL \" Window/Display System Info \" " ) ;
hexchat_printf ( ph , " %s plugin unloaded \n " , name ) ;
2012-10-21 09:56:09 +02:00
return 1 ;
}