comparison src/protocols/gg/gg.c @ 3466:7a3f16a375a5

[gaim-migrate @ 3516] some patches from some people. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 29 Aug 2002 01:47:15 +0000
parents 8fa61405af2b
children bdd0bebd2d04
comparison
equal deleted inserted replaced
3465:ec437d73b2ee 3466:7a3f16a375a5
1 /* 1 /*
2 * gaim - Gadu-Gadu Protocol Plugin 2 * gaim - Gadu-Gadu Protocol Plugin
3 * $Id: gg.c 3453 2002-08-25 10:51:24Z seanegan $ 3 * $Id: gg.c 3516 2002-08-29 01:47:15Z seanegan $
4 * 4 *
5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> 5 * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
102 static char *agg_name() 102 static char *agg_name()
103 { 103 {
104 return "Gadu-Gadu"; 104 return "Gadu-Gadu";
105 } 105 }
106 106
107 static gchar *charset_convert(const gchar *locstr, char *encsrc, char *encdst) 107 static gchar *charset_convert(const gchar *locstr, const char *encsrc, const char *encdst)
108 { 108 {
109 #ifdef HAVE_ICONV 109 #ifdef HAVE_ICONV
110 gchar *result = NULL; 110 gchar *result = NULL;
111 if (iconv_string(encdst, encsrc, locstr, locstr + strlen(locstr) + 1, &result, NULL) >= 0) 111 if (iconv_string(encdst, encsrc, locstr, locstr + strlen(locstr) + 1, &result, NULL) >= 0)
112 return result; 112 return result;
113 #endif 113 #endif
114 return g_strdup(locstr); 114 return g_strdup(locstr);
115 } 115 }
116 116
117 static gboolean invalid_uin(char *uin) 117 static gboolean invalid_uin(const char *uin)
118 { 118 {
119 unsigned long int res = strtol(uin, (char **)NULL, 10); 119 unsigned long int res = strtol(uin, (char **)NULL, 10);
120 if (res == LONG_MIN || res == LONG_MAX || res == 0) 120 if (res == LONG_MIN || res == LONG_MAX || res == 0)
121 return TRUE; 121 return TRUE;
122 return FALSE; 122 return FALSE;
157 return TRUE; 157 return TRUE;
158 break; 158 break;
159 } 159 }
160 } 160 }
161 161
162 static gchar *find_local_charset(void) 162 static const gchar *find_local_charset(void)
163 { 163 {
164 gchar *gg_localenc = g_getenv("GG_CHARSET"); 164 const gchar *gg_localenc = g_getenv("GG_CHARSET");
165 165
166 if (gg_localenc == NULL) { 166 if (gg_localenc == NULL) {
167 #ifdef HAVE_LANGINFO_CODESET 167 #ifdef HAVE_LANGINFO_CODESET
168 gg_localenc = nl_langinfo(CODESET); 168 gg_localenc = nl_langinfo(CODESET);
169 #else 169 #else
605 g_free(imsg); 605 g_free(imsg);
606 } 606 }
607 return 1; 607 return 1;
608 } 608 }
609 609
610 static void agg_add_buddy(struct gaim_connection *gc, char *who) 610 static void agg_add_buddy(struct gaim_connection *gc, const char *who)
611 { 611 {
612 struct agg_data *gd = (struct agg_data *)gc->proto_data; 612 struct agg_data *gd = (struct agg_data *)gc->proto_data;
613 if (invalid_uin(who)) 613 if (invalid_uin(who))
614 return; 614 return;
615 gg_add_notify(gd->sess, strtol(who, (char **)NULL, 10)); 615 gg_add_notify(gd->sess, strtol(who, (char **)NULL, 10));
1064 g_free(he); 1064 g_free(he);
1065 return; 1065 return;
1066 } 1066 }
1067 } 1067 }
1068 1068
1069 static void agg_dir_search(struct gaim_connection *gc, char *first, char *middle, 1069 static void agg_dir_search(struct gaim_connection *gc, const char *first, const char *middle,
1070 char *last, char *maiden, char *city, char *state, 1070 const char *last, const char *maiden, const char *city, const char *state,
1071 char *country, char *email) 1071 const char *country, const char *email)
1072 { 1072 {
1073 struct agg_http *srch = g_new0(struct agg_http, 1); 1073 struct agg_http *srch = g_new0(struct agg_http, 1);
1074 srch->gc = gc; 1074 srch->gc = gc;
1075 srch->type = AGG_HTTP_SEARCH; 1075 srch->type = AGG_HTTP_SEARCH;
1076 srch->form = AGG_PUBDIR_SEARCH_FORM; 1076 srch->form = AGG_PUBDIR_SEARCH_FORM;
1113 g_free(srch); 1113 g_free(srch);
1114 return; 1114 return;
1115 } 1115 }
1116 } 1116 }
1117 1117
1118 static void agg_change_passwd(struct gaim_connection *gc, char *old, char *new) 1118 static void agg_change_passwd(struct gaim_connection *gc, const char *old, const char *new)
1119 { 1119 {
1120 struct agg_http *hpass = g_new0(struct agg_http, 1); 1120 struct agg_http *hpass = g_new0(struct agg_http, 1);
1121 gchar *u = gg_urlencode(gc->username); 1121 gchar *u = gg_urlencode(gc->username);
1122 gchar *p = gg_urlencode(gc->password); 1122 gchar *p = gg_urlencode(gc->password);
1123 gchar *enew = gg_urlencode(new); 1123 gchar *enew = gg_urlencode(new);