index : torxchat.git

this commit

branch-info

default

fe-web

feature/flexible-cert

feature/fork-branding

feature/tls-srp

feature/tor-i2p-dcc

fix-ub

Unnamed repository; edit this file 'description' to name the repository. | blog

summary refs log tree commit diff stats

log msg

author

committer

range

path: root/src/common/common.vcxproj

Age | Commit message (Expand) | Author
2014-09-17 | win32: Fixed build break due to 7a4a024 | Arnavion
2014-06-04 | win32: Use config.h instead of config-win32.h | TingPing
2014-06-03 | win32: Don't auto-generate version.txt | TingPing
2014-03-18 | win32: Powershell.exe absolutely needs "-File" when running scripts or else i... | Arnavion
2014-02-06 | Use a single marshal file for entire project | TingPing
2013-12-27 | Replaced use of T4 templates with PS-based templates. | Arnavion
2013-11-03 | Use correct path to TextTransform.exe depending on the platform. | Arnavion
2013-10-12 | win32: Use version information from configure.ac to populate the Windows-spec... | Arnavion
2013-09-26 | Remove remnants of native file dialogs | TingPing
2013-09-15 | Convert project files to vs2013 | Eustachy Kapusta
2013-07-24 | Move optimization settings from all subsequent projects to hexchat.props | Eustachy Kapusta
2013-04-25 | win32: Moved PlatformToolset configuration to individual project files. It sh... | Arnavion
2013-04-14 | Remove one warning bypass | Berke Viktor
2013-04-03 | Remove strlutil | Berke Viktor
2012-11-11 | Fix 4996 warnings | Berke Viktor
2012-11-11 | Hide 4996 warnings in all projects and fix license copy | Berke Viktor
2012-11-10 | Eliminate some more warnings and hide less warnings in VS | Berke Viktor
2012-11-06 | Disable some stupid warnings without the WDK | Berke Viktor
2012-11-04 | Ignore specific warnings for common and fe-gtk, all should be eliminated at s... | Berke Viktor
2012-10-28 | Use Consolas as the default font where available | Berke Viktor
2012-10-27 | Ignore generated config.h properly on Unix | Berke Viktor
2012-10-24 | A lot more rebranding | Berke Viktor
2012-10-21 | Move warning level to property sheet | Berke Viktor
2012-10-21 | Relocate typedef.h | Berke Viktor
2012-10-03 | Complete the VS2010 reversion | Berke Viktor
2012-10-03 | Revert to VS2010 part4 | Berke Viktor
2012-10-02 | Oops, wrong find'n'replace | Berke Viktor
2012-10-02 | Remove hardcoding as much as possible | Berke Viktor
2012-10-02 | Change platform toolset to Visual Studio 2012 | Berke Viktor
2012-09-24 | Add strlcat() and strlcpy(), might convert to them in the future | Berke Viktor
2012-09-15 | Update solution to Visual Studio 2012 Express and get rid of mpcInfo | Berke Viktor
2012-07-21 | Add _AMD64_ definition for x64 builds, make Visual Studio even happier | Berke Viktor
2012-07-21 | Add trailing backslashes to Output and Intermediate directories, make Visual ... | Berke Viktor
2012-07-11 | Rebranding on the file level | Berke Viktor
2012-06-15 | Add x64 support to the VS solution | Berke Viktor
2012-06-15 | LOTS of fixes to the VS solution | Berke Viktor
2012-06-10 | Migrate VS solution to VS2010+WDK7 | Berke Viktor

generated by cgit-pink 1.4.1 (git 2.36.1) at 2024-12-26 16:49:34 +0000

0000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */

/*
* SysInfo - sysinfo plugin for HexChat
* Copyright (c) 2015 Patrick Griffis.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/

/*
* Some snippets based upon Textual's System Profiler plugin.
* https://github.com/Codeux-Software/Textual
*/

#import <Cocoa/Cocoa.h>

#include <sys/sysctl.h>
#include <mach/mach.h>
#include <mach/mach_host.h>
#include <mach/host_info.h>
#include <mach/mach_vm.h>

#include <glib.h>

#include "format.h"
#include "df.h"

static char *
get_os (void)
{
NSDictionary *systemversion = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSString *build = [systemversion objectForKey:@"ProductBuildVersion"];
if (!build)
return NULL;
NSString *version = [systemversion objectForKey:@"ProductUserVisibleVersion"];
if (!version)
{
[build release];
return NULL;
}

NSDictionary *profiler = [NSDictionary dictionaryWithContentsOfFile:[@"~/Library/Preferences/com.apple.SystemProfiler.plist" stringByExpandingTildeInPath]];
NSDictionary *names = [profiler objectForKey:@"OS Names"];
NSString *os_name = nil;

for (NSString *name in names)
{
if ([name hasPrefix:build])
{
os_name = [names objectForKey:name];
break;
}
}
[build release];

if (!os_name)
{
[version release];
return NULL;
}

char *ret = g_strdup_printf ("%s %s", [os_name UTF8String], [version UTF8String]);
[version release];

return ret;
}

static char *
get_os_fallback (void)
{
#if !defined (MAC_OS_X_VERSION_10_9) || MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_9
SInt32 ver_major = 0,
ver_minor = 0,
ver_patch = 0;

Gestalt (gestaltSystemVersionMajor, &ver_major);
Gestalt (gestaltSystemVersionMinor, &ver_minor);
Gestalt (gestaltSystemVersionBugFix, &ver_patch);

return g_strdup_printf ("OS X %d.%d.%d", ver_major, ver_minor, ver_patch);
#else
NSProcessInfo *info = [NSProcessInfo processInfo];
NSOperatingSystemVersion version = [info operatingSystemVersion];

return g_strdup_printf ("OS X %ld.%ld.%ld", version.majorVersion, version.minorVersion, version.patchVersion);
#endif
}
char *
sysinfo_backend_get_os(void)
{
static char *os_str = NULL;
if (!os_str)
{
os_str = get_os();
if (!os_str)
os_str = get_os_fallback();
}
return g_strdup (os_str);
}

char *
sysinfo_backend_get_disk(void)
{
gint64 total, free_space;

if (xs_parse_df (&total, &free_space))
{
return NULL;
}

return sysinfo_format_disk (total, free_space);
}

static guint64
get_free_memory (void)
{
mach_msg_type_number_t infoCount = (sizeof(vm_statistics_data_t) / sizeof(natural_t));

vm_size_t pagesize;
vm_statistics_data_t vm_stat;

host_page_size(mach_host_self(), &pagesize);

if (host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vm_stat, &infoCount) == KERN_SUCCESS)
return ((vm_stat.inactive_count + vm_stat.free_count) * pagesize);

return 0;
}

char *
sysinfo_backend_get_memory(void)
{
NSProcessInfo *info = [NSProcessInfo processInfo];
guint64 totalmem, freemem;

totalmem = [info physicalMemory];

if ((freemem = get_free_memory()) == 0)
return NULL;

return sysinfo_format_memory (totalmem, freemem);
}

char *
sysinfo_backend_get_cpu(void)
{
guint64 cpu_clock_uint = 0;
double cpu_clock;
char cpu_string[256];
gsize len;
gboolean giga = FALSE;

len = sizeof(cpu_string);
if (sysctlbyname ("machdep.cpu.brand_string", cpu_string, &len, NULL, 0) != 0)
return NULL;
cpu_string[sizeof(cpu_string) - 1] = '\0';

len = sizeof(cpu_clock_uint);
if (sysctlbyname("hw.cpufrequency", &cpu_clock_uint, &len, NULL, 0) < 0)
return NULL;

cpu_clock = cpu_clock_uint / 1000000;
if (cpu_clock > 1000)
{
cpu_clock /= 1000;
giga = TRUE;
}

if (giga)
return g_strdup_printf ("%s (%.2fGHz)", cpu_string, cpu_clock);
else
return g_strdup_printf ("%s (%.0fMHz)", cpu_string, cpu_clock);
}

static char *
get_gpu(void)
{
CFMutableDictionaryRef pciDevices = IOServiceMatching("IOPCIDevice");
io_iterator_t entry_iterator, serviceObject;

if (IOServiceGetMatchingServices(kIOMasterPortDefault, pciDevices, &entry_iterator) != kIOReturnSuccess)
return NULL;

GString *gpu_list = g_string_new(NULL);
while ((serviceObject = IOIteratorNext(entry_iterator)))
{
CFMutableDictionaryRef serviceDictionary;

kern_return_t status = IORegistryEntryCreateCFProperties(serviceObject, &serviceDictionary,
kCFAllocatorDefault, kNilOptions);

if (status != kIOReturnSuccess)
{
IOObjectRelease(serviceObject);
continue;
}

const void *class = CFDictionaryGetValue(serviceDictionary, @"class-code");
if (!class || *(guint32*)CFDataGetBytePtr(class) != 0x30000) /* DISPLAY_VGA */
{
CFRelease(serviceDictionary);
continue;
}

const void *model = CFDictionaryGetValue(serviceDictionary, @"model");
if (model)
{
if (CFGetTypeID(model) == CFDataGetTypeID() && CFDataGetLength(model) > 1)
{
if (gpu_list->len != 0)
g_string_append (gpu_list, ", ");
g_string_append_len (gpu_list, (const char*)CFDataGetBytePtr(model), CFDataGetLength(model) - 1);
}
}

CFRelease(serviceDictionary);
}

if (gpu_list->len == 0)
{
g_string_free (gpu_list, TRUE);
return NULL;
}

/* The string may contain nul-chars we must replace */
int i;
for (i = 0; i < gpu_list->len; i++)
{
if (gpu_list->str[i] == '\0')
gpu_list->str[i] = ' ';
}

return g_string_free (gpu_list, FALSE);
}

char *
sysinfo_backend_get_gpu(void)
{
static char *gpu_str = NULL;
if (!gpu_str)
gpu_str = get_gpu();

return g_strdup (gpu_str);
}

char *
sysinfo_backend_get_sound(void)
{
return NULL;
}

char *
sysinfo_backend_get_uptime(void)
{
NSProcessInfo *info = [NSProcessInfo processInfo];
double uptime = [info systemUptime];

return sysinfo_format_uptime ((gint64)uptime);
}

char *
sysinfo_backend_get_network(void)
{
return NULL;
}

generated by cgit-pink 1.4.1 (git 2.36.1) at 2024-12-26 16:49:34 +0000