Mon, 09 Feb 2009 21:21:18 +0000
Set a value "type" in the ui_info hash table
Set client type in resonse to an XMPP XEP-0115 request (client type).
Makes Pidgin report itself as "pc", Finch as "console"
Display emblems on XMPP buddies corresponding to their client type
(if available). Currently there is no emblem for "console"
| 3630 | 1 | /* |
| 2 | posix.uname.c - version 1.1 | |
| 3 | Copyright (C) 1999, 2000 | |
| 4 | Earnie Boyd and assigns | |
| 5 | ||
| 6 | Fills the utsname structure with the appropriate values. | |
| 7 | ||
| 8 | This program is free software; you can redistribute it and/or modify | |
| 9 | it under the terms of the GNU Lesser General Public License as published | |
| 10 | by the Free Software Foundation; either version 2.1, or (at your option) | |
| 11 | any later version. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICUALR PURPOSE. See the | |
| 16 | GNU Lesser General Public License for more details. | |
| 17 | ||
| 18 | You should have received a copy of the GNU General Public License | |
| 19 | along with this program; if not, write to the Free Software Foundation, | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15435
diff
changeset
|
20 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
| 3630 | 21 | */ |
| 22 | ||
| 23 | /* | |
| 24 | Send bug reports to Earnie Boyd <earnie_boyd@yahoo.com> | |
| 25 | */ | |
| 26 | ||
| 27 | #include "utsname.h" | |
| 28 | #include <string.h> | |
| 29 | #include <stdio.h> | |
| 30 | ||
| 31 | /* ANONYMOUS unions and structs are used from the windows header definitions. | |
| 32 | These need to be defined for them to work correctly with gcc2.95.2-mingw. */ | |
| 33 | /*#define _ANONYMOUS_STRUCT*/ | |
| 34 | /*#define _ANONYMOUS_UNION*/ | |
| 35 | #include <windows.h> | |
| 23074 | 36 | #ifdef __MINGW32__ |
| 3630 | 37 | #include <_mingw.h> |
| 23074 | 38 | #endif |
| 3630 | 39 | |
| 40 | int | |
| 23074 | 41 | jabber_win32_uname( struct utsname *uts ) |
| 3630 | 42 | { |
| 43 | DWORD sLength; | |
| 44 | OSVERSIONINFO OS_version; | |
| 45 | SYSTEM_INFO System_Info; | |
| 46 | ||
| 47 | /* XXX Should these be in the global runtime */ | |
| 48 | enum WinOS {Win95, Win98, WinNT, unknown}; | |
| 49 | int MingwOS; | |
| 50 | ||
| 51 | memset( uts, 0, sizeof ( *uts ) ); | |
| 52 | OS_version.dwOSVersionInfoSize = sizeof( OSVERSIONINFO ); | |
| 53 | ||
| 54 | GetVersionEx ( &OS_version ); | |
| 55 | GetSystemInfo ( &System_Info ); | |
| 56 | ||
| 23074 | 57 | strcpy( uts->sysname, "WIN32_" ); |
| 3630 | 58 | switch( OS_version.dwPlatformId ) |
| 59 | { | |
| 60 | case VER_PLATFORM_WIN32_NT: | |
| 61 | strcat( uts->sysname, "WinNT" ); | |
| 62 | MingwOS = WinNT; | |
| 63 | break; | |
| 64 | case VER_PLATFORM_WIN32_WINDOWS: | |
| 65 | switch ( OS_version.dwMinorVersion ) | |
| 66 | { | |
| 67 | case 0: | |
| 68 | strcat( uts->sysname, "Win95" ); | |
| 69 | MingwOS = Win95; | |
| 70 | break; | |
| 71 | case 10: | |
| 72 | strcat( uts->sysname, "Win98" ); | |
| 73 | MingwOS = Win98; | |
| 74 | break; | |
| 75 | default: | |
| 76 | strcat( uts->sysname, "Win??" ); | |
| 77 | MingwOS = unknown; | |
| 78 | break; | |
| 79 | } | |
| 80 | break; | |
| 81 | default: | |
| 82 | strcat( uts->sysname, "Win??" ); | |
| 83 | MingwOS = unknown; | |
| 84 | break; | |
| 85 | } | |
| 86 | ||
| 23074 | 87 | #ifdef __MINGW32__ |
| 3630 | 88 | sprintf( uts->version, "%i", __MINGW32_MAJOR_VERSION ); |
| 89 | sprintf( uts->release, "%i", __MINGW32_MINOR_VERSION ); | |
| 23074 | 90 | #endif |
| 3630 | 91 | |
| 92 | switch( System_Info.wProcessorArchitecture ) | |
| 93 | { | |
| 94 | case PROCESSOR_ARCHITECTURE_PPC: | |
| 95 | strcpy( uts->machine, "ppc" ); | |
| 96 | break; | |
| 97 | case PROCESSOR_ARCHITECTURE_ALPHA: | |
| 98 | strcpy( uts->machine, "alpha" ); | |
| 99 | break; | |
| 100 | case PROCESSOR_ARCHITECTURE_MIPS: | |
| 101 | strcpy( uts->machine, "mips" ); | |
| 102 | break; | |
| 103 | case PROCESSOR_ARCHITECTURE_INTEL: | |
| 104 | /* dwProcessorType is only valid in Win95 and Win98 | |
| 105 | wProcessorLevel is only valid in WinNT */ | |
| 106 | switch( MingwOS ) | |
| 107 | { | |
| 108 | case Win95: | |
| 109 | case Win98: | |
| 110 | switch( System_Info.dwProcessorType ) | |
| 111 | { | |
| 112 | case PROCESSOR_INTEL_386: | |
| 113 | case PROCESSOR_INTEL_486: | |
| 114 | case PROCESSOR_INTEL_PENTIUM: | |
| 115 | sprintf( uts->machine, "i%ld", System_Info.dwProcessorType ); | |
| 116 | break; | |
| 117 | default: | |
| 118 | strcpy( uts->machine, "i386" ); | |
| 119 | break; | |
| 120 | } | |
| 121 | break; | |
| 122 | case WinNT: | |
| 123 | sprintf( uts->machine, "i%d86", System_Info.wProcessorLevel ); | |
| 124 | break; | |
| 125 | default: | |
| 126 | strcpy( uts->machine, "unknown" ); | |
| 127 | break; | |
| 128 | } | |
| 129 | break; | |
| 130 | default: | |
| 131 | strcpy( uts->machine, "unknown" ); | |
| 132 | break; | |
| 133 | } | |
| 134 | ||
| 135 | sLength = sizeof ( uts->nodename ) - 1; | |
| 136 | GetComputerNameA( uts->nodename, &sLength ); | |
| 137 | return 1; | |
| 138 | } | |
| 139 |