Mercurial > pidgin
comparison libpurple/protocols/oscar/util.c @ 27590:a08e84032814
merge of '2348ff22f0ff3453774b8b25b36238465580c609'
and 'e76f11543c2a4aa05bdf584f087cbe3439029661'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 12 Jul 2009 05:43:38 +0000 |
parents | 74e487f82f39 |
children | f18b6eb0ed02 |
comparison
equal
deleted
inserted
replaced
27104:048bcf41deef | 27590:a08e84032814 |
---|---|
24 * It started with a kiss | 24 * It started with a kiss |
25 * Now we're up to bat | 25 * Now we're up to bat |
26 */ | 26 */ |
27 | 27 |
28 #include "oscar.h" | 28 #include "oscar.h" |
29 | |
30 #include "core.h" | |
31 | |
29 #include <ctype.h> | 32 #include <ctype.h> |
30 | 33 |
31 #ifdef _WIN32 | 34 #ifdef _WIN32 |
32 #include "win32dep.h" | 35 #include "win32dep.h" |
33 #endif | 36 #endif |
37 | |
38 int oscar_get_ui_info_int(const char *str, int default_value) | |
39 { | |
40 GHashTable *ui_info; | |
41 | |
42 ui_info = purple_core_get_ui_info(); | |
43 if (ui_info != NULL) { | |
44 gpointer value; | |
45 if (g_hash_table_lookup_extended(ui_info, str, NULL, &value)) | |
46 return GPOINTER_TO_INT(value); | |
47 } | |
48 | |
49 return default_value; | |
50 } | |
51 | |
52 const char *oscar_get_ui_info_string(const char *str, const char *default_value) | |
53 { | |
54 GHashTable *ui_info; | |
55 const char *value = NULL; | |
56 | |
57 ui_info = purple_core_get_ui_info(); | |
58 if (ui_info != NULL) | |
59 value = g_hash_table_lookup(ui_info, str); | |
60 if (value == NULL) | |
61 value = default_value; | |
62 | |
63 return value; | |
64 } | |
65 | |
66 gchar *oscar_get_clientstring(void) | |
67 { | |
68 const char *name, *version; | |
69 | |
70 name = oscar_get_ui_info_string("name", "Purple"); | |
71 version = oscar_get_ui_info_string("version", VERSION); | |
72 | |
73 return g_strdup_printf("%s/%s", name, version);; | |
74 } | |
34 | 75 |
35 /* | 76 /* |
36 * Tokenizing functions. Used to portably replace strtok/sep. | 77 * Tokenizing functions. Used to portably replace strtok/sep. |
37 * -- DMP. | 78 * -- DMP. |
38 * | 79 * |