Mercurial > pidgin
comparison src/protocols/qq/utils.c @ 14055:44e1bf83dadf
[gaim-migrate @ 16668]
We have gaim_str_has_prefix() to use in place of g_str_has_prefix().
committer: Tailor Script <tailor@pidgin.im>
| author | Richard Laager <rlaager@wiktel.com> |
|---|---|
| date | Tue, 08 Aug 2006 00:25:19 +0000 |
| parents | 51f71ad82141 |
| children |
comparison
equal
deleted
inserted
replaced
| 14054:51f71ad82141 | 14055:44e1bf83dadf |
|---|---|
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #include "char_conv.h" | 31 #include "char_conv.h" |
| 32 #include "debug.h" | 32 #include "debug.h" |
| 33 #include "prefs.h" | 33 #include "prefs.h" |
| 34 #include "util.h" | |
| 34 #include "utils.h" | 35 #include "utils.h" |
| 35 | 36 |
| 36 #define QQ_NAME_FORMAT "qq-%d" | 37 #define QQ_NAME_FORMAT "qq-%d" |
| 37 | |
| 38 #if !GLIB_CHECK_VERSION(2, 1, 0) | |
| 39 gint g_str_has_prefix(const gchar *str, const gchar *prefix) | |
| 40 { | |
| 41 gint len = strlen(prefix); | |
| 42 return !strncmp(str, prefix, len); | |
| 43 } | |
| 44 #endif | |
| 45 | 38 |
| 46 gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount) | 39 gchar *get_name_by_index_str(gchar **array, const gchar *index_str, gint amount) |
| 47 { | 40 { |
| 48 gint index; | 41 gint index; |
| 49 | 42 |
| 158 /* convert GAIM name to original QQ UID */ | 151 /* convert GAIM name to original QQ UID */ |
| 159 guint32 gaim_name_to_uid(const gchar *name) | 152 guint32 gaim_name_to_uid(const gchar *name) |
| 160 { | 153 { |
| 161 gchar *p; | 154 gchar *p; |
| 162 | 155 |
| 163 g_return_val_if_fail(g_str_has_prefix(name, QQ_NAME_PREFIX), 0); | 156 g_return_val_if_fail(gaim_str_has_prefix(name, QQ_NAME_PREFIX), 0); |
| 164 | 157 |
| 165 p = g_strrstr(name, QQ_NAME_PREFIX); | 158 p = g_strrstr(name, QQ_NAME_PREFIX); |
| 166 return (p == NULL) ? 0 : strtol(p + strlen(QQ_NAME_PREFIX), NULL, 10); | 159 return (p == NULL) ? 0 : strtol(p + strlen(QQ_NAME_PREFIX), NULL, 10); |
| 167 } | 160 } |
| 168 | 161 |
