1 diff -aurN gg2-2.2.8/src/plugins/sms/sms_core.c gg2-2.2.8.cvs/src/plugins/sms/sms_core.c
2 --- gg2-2.2.8/src/plugins/sms/sms_core.c 2005-09-01 16:49:47.000000000 +0200
3 +++ gg2-2.2.8.cvs/src/plugins/sms/sms_core.c 2005-09-24 05:44:20.000000000 +0200
9 * SMS plugin for GNU Gadu 2
14 -extern char *idea_token_path;
15 +extern char *orange_token_path;
18 /* URLencoding code by Ahmad Baitalmal <ahmad@bitbuilder.com>
23 -/* laczenie sie z wybranym hostem, zwraca -1 przy b³edzie, inaczej 0 */
24 +/* laczenie sie z wybranym hostem, zwraca -1 przy błedzie, inaczej 0 */
25 gint sms_connect(gchar * sms_info, gchar * sms_host, int *sock_s)
29 g_free(message->number);
30 g_free(message->sender);
31 g_free(message->body);
32 - g_free(message->idea_token);
33 - g_free(message->idea_pass);
34 + g_free(message->orange_token);
35 + g_free(message->orange_pass);
41 /* tu bedzie wymiana na cos innego, GUI musi to obslugiwac a nie "samowolka" ;-) */
42 -gboolean IDEA_logo(SMS * user_data)
43 +gboolean ORANGE_logo(SMS * user_data)
45 - GGaduDialog *dialog = ggadu_dialog_new_full(GGADU_DIALOG_GENERIC, _("IDEA token"), "get token", user_data);
46 + GGaduDialog *dialog = ggadu_dialog_new_full(GGADU_DIALOG_GENERIC, _("ORANGE token"), "get token", user_data);
48 - ggadu_dialog_add_entry(dialog, 0, "", VAR_IMG, idea_token_path, VAR_FLAG_NONE);
49 + ggadu_dialog_add_entry(dialog, 0, "", VAR_IMG, orange_token_path, VAR_FLAG_NONE);
50 ggadu_dialog_add_entry(dialog, 1, _("Enter token text"), VAR_STR, NULL, VAR_FLAG_NONE);
52 signal_emit_from_thread("sms", "gui show dialog", dialog, "main-gui");
56 /* wyslanie na idee */
57 -gint send_IDEA(SMS * message)
58 +gint send_ORANGE(SMS * message)
63 gchar *recv_buff = NULL;
65 gint i = 0, j, k, retries = 3;
68 HTTPstruct *HTTP = NULL;
72 HTTP = httpstruct_new();
73 HTTP->method = SMS_METHOD_GET;
74 - HTTP->host = g_strdup(GGADU_SMS_IDEA_HOST);
75 - HTTP->url = g_strdup(GGADU_SMS_IDEA_URL_GET);
76 + HTTP->host = g_strdup(GGADU_SMS_ORANGE_HOST);
77 + HTTP->url = g_strdup(GGADU_SMS_ORANGE_URL_GET);
78 HTTP->url_params = g_strdup(" ");
81 /* pobranie adresu do obrazka */
82 - if (sms_connect("IDEA", "213.218.116.131", &sock_s))
83 + if (sms_connect("ORANGE", "213.218.116.131", &sock_s))
85 httpstruct_free(HTTP);
91 - print_debug("\n=======retries left: %d=====\nIDEA RECVBUFF1: %s\n\n", retries - 1, recv_buff);
92 + print_debug("\n=======retries left: %d=====\nORANGE RECVBUFF1: %s\n\n", retries - 1, recv_buff);
94 if (!g_strstr_len(recv_buff, i, "200 OK"))
97 return ERR_READ_TOKEN;
100 - if (!(token = g_strndup(buf + 24, GGADU_SMS_IDEA_TOKENLEN)))
101 + if (!(token = g_strndup(buf + 24, GGADU_SMS_ORANGE_TOKENLEN)))
104 return ERR_READ_TOKEN;
107 - if (strlen(token) < GGADU_SMS_IDEA_TOKENLEN)
108 + if (strlen(token) < GGADU_SMS_ORANGE_TOKENLEN)
112 @@ -319,12 +319,12 @@
114 HTTP = httpstruct_new();
115 HTTP->method = SMS_METHOD_GET;
116 - HTTP->host = g_strdup(GGADU_SMS_IDEA_HOST);
117 + HTTP->host = g_strdup(GGADU_SMS_ORANGE_HOST);
118 HTTP->url = g_strdup(gettoken);
119 HTTP->url_params = g_strdup(" ");
122 - if (sms_connect("IDEA", GGADU_SMS_IDEA_HOST, &sock_s))
123 + if (sms_connect("ORANGE", GGADU_SMS_ORANGE_HOST, &sock_s))
125 httpstruct_free(HTTP);
131 - print_debug("\n============retries left: %d=================\nIDEA RECVBUFF2: %s\n\n", retries, recv_buff);
132 + print_debug("\n============retries left: %d=================\nORANGE RECVBUFF2: %s\n\n", retries, recv_buff);
134 if (!g_strstr_len(recv_buff, i, "200 OK"))
137 recv_buff[k] = recv_buff[k + j];
140 - /* oops, bail out if idea_token_path cannot be written. */
141 - if (!(idea_logo = fopen(idea_token_path, "w")))
142 + /* oops, bail out if orange_token_path cannot be written. */
143 + if (!(orange_logo = fopen(orange_token_path, "w")))
150 /* write token image to file, close fd */
151 - fwrite(recv_buff, 1, i - j, idea_logo);
153 + fwrite(recv_buff, 1, i - j, orange_logo);
154 + fclose(orange_logo);
158 @@ -399,15 +399,15 @@
159 message2->sender = g_strdup(message->sender);
160 message2->body = g_strdup(message->body);
162 - message2->idea_token = token;
163 - message2->idea_pass = NULL;
164 + message2->orange_token = token;
165 + message2->orange_pass = NULL;
167 - IDEA_logo(message2);
168 + ORANGE_logo(message2);
173 -gpointer send_IDEA_stage2(SMS * message)
174 +gpointer send_ORANGE_stage2(SMS * message)
176 gchar *recv_buff = NULL;
181 /* is there any better place for this? */
182 - unlink(idea_token_path);
183 + unlink(orange_token_path);
191 - if (!message->idea_pass)
192 + if (!message->orange_pass)
194 sms_warning(message->number, _("Please enter token"));
198 sender = ggadu_sms_urlencode(g_strdup(message->sender));
199 body = ggadu_sms_urlencode(g_strdup(message->body));
200 - post = g_strconcat("token=", message->idea_token, "&SENDER=", sender, "&RECIPIENT=", sms_number, "&SHORT_MESSAGE=", body, "&pass=",
201 - message->idea_pass, "&respInfo=2", NULL);
202 + post = g_strconcat("token=", message->orange_token, "&SENDER=", sender, "&RECIPIENT=", sms_number, "&SHORT_MESSAGE=", body, "&pass=",
203 + message->orange_pass, "&respInfo=2", NULL);
207 @@ -456,15 +456,15 @@
209 HTTP = httpstruct_new();
210 HTTP->method = SMS_METHOD_POST;
211 - HTTP->host = g_strdup(GGADU_SMS_IDEA_HOST);
212 - HTTP->url = g_strdup(GGADU_SMS_IDEA_URL_SEND);
213 + HTTP->host = g_strdup(GGADU_SMS_ORANGE_HOST);
214 + HTTP->url = g_strdup(GGADU_SMS_ORANGE_URL_SEND);
215 HTTP->url_params = g_strdup(" ");
216 HTTP->post_data = g_strdup(post);
217 HTTP->post_length = strlen(post);
221 - if (sms_connect("IDEA", "213.218.116.131", &sock_s))
222 + if (sms_connect("ORANGE", "213.218.116.131", &sock_s))
224 sms_warning(message->number, _("Cannot connect!"));
225 httpstruct_free(HTTP);
230 - print_debug("\n============retries left: %d===================\nIDEA RECVBUFF3: %s\n\n", retries, recv_buff);
231 + print_debug("\n============retries left: %d===================\nORANGE RECVBUFF3: %s\n\n", retries, recv_buff);
233 if (!g_strstr_len(recv_buff, i, "200 OK"))
235 @@ -498,10 +498,10 @@
236 httpstruct_free(HTTP);
239 - if (g_strstr_len(recv_buff, i, "SMS zosta³ wys³any"))
240 + if (g_strstr_len(recv_buff, i, "SMS został wysłany"))
241 sms_message(message->number, _("SMS has been sent"));
243 - else if (g_strstr_len(recv_buff, i, "Podano b³êdne has³o, SMS nie zosta³ wys³any"))
244 + else if (g_strstr_len(recv_buff, i, "Podano błędne hasło, SMS nie został wysłany"))
245 sms_warning(message->number, _("Bad token!"));
247 else if (g_strstr_len(recv_buff, i, "Object moved"))
249 else if (g_strstr_len(recv_buff, i, "serwis chwilowo"))
250 sms_warning(message->number, _("Gateway error!"));
252 - else if (g_strstr_len(recv_buff, i, "nie ma aktywnej us³ugi"))
253 + else if (g_strstr_len(recv_buff, i, "nie ma aktywnej usługi"))
254 sms_warning(message->number, _("Service not activated!"));
256 else if (g_strstr_len(recv_buff, i, "adres odbiorcy wiadomosci jest nieprawid"))
257 @@ -591,11 +591,11 @@
259 if (!strlen(recv_buff))
261 - else if (g_strstr_len(recv_buff, i, "wiadomo¶æ zosta³a wys³ana na numer"))
262 + else if (g_strstr_len(recv_buff, i, "wiadomość została wysłana na numer"))
264 - else if (g_strstr_len(recv_buff, i, "podano z³y numer"))
265 + else if (g_strstr_len(recv_buff, i, "podano zły numer"))
267 - else if (g_strstr_len(recv_buff, i, "Z powodu przekroczenia limitów bramki"))
268 + else if (g_strstr_len(recv_buff, i, "Z powodu przekroczenia limitów bramki"))
275 if (*sms_number == '5')
279 if (*sms_number == '6')
281 @@ -789,14 +789,14 @@
282 gsm_oper = check_operator(message->number);
287 if (message->external)
289 result = system(g_strconcat("sms ", message->number, " \"", message->body, " ", message->sender, "\"", NULL));
293 - result = send_IDEA(message);
294 + result = send_ORANGE(message);
302 - /* dirty IDEA workaround: we can't handle send_idea*() return values here,
303 - send_idea*() eventually notifies about success itself. */
304 + /* dirty ORANGE workaround: we can't handle send_orange*() return values here,
305 + send_orange*() eventually notifies about success itself. */
306 if (gsm_oper == SMS_PLUS)
307 sms_message(message->number, _("SMS has been sent"));
308 else if (gsm_oper == SMS_ERA)
309 diff -aurN gg2-2.2.8/src/plugins/sms/sms_core.h gg2-2.2.8.cvs/src/plugins/sms/sms_core.h
310 --- gg2-2.2.8/src/plugins/sms/sms_core.h 2005-09-01 16:49:47.000000000 +0200
311 +++ gg2-2.2.8.cvs/src/plugins/sms/sms_core.h 2005-09-24 05:44:20.000000000 +0200
317 * SMS plugin for GNU Gadu 2
319 #define GGADU_SMS_PLUS_HOST "www.text.plusgsm.pl"
320 #define GGADU_SMS_PLUS_URL "/sms/sendsms.php"
322 -#define GGADU_SMS_IDEA_HOST "sms.idea.pl"
323 -#define GGADU_SMS_IDEA_URL_GET "/"
324 -#define GGADU_SMS_IDEA_URL_SEND "/sendsms.aspx"
325 +#define GGADU_SMS_ORANGE_HOST "sms.orange.pl"
326 +#define GGADU_SMS_ORANGE_URL_GET "/Default.aspx?id=A2B6173D-CF1A-4c38-B7A7-E3144D43D70C"
327 +#define GGADU_SMS_ORANGE_URL_SEND "/sendsms.aspx"
329 #define GGADU_SMS_ERA_HOST "www.eraomnix.pl"
330 #define GGADU_SMS_ERA_URL "/msg/api/do/tinker/sponsored"
333 #define GGADU_SMS_RECVBUFF_LEN 32768
335 -#define IDEA_GFX "/idea_token.gfx"
336 -#define GGADU_SMS_IDEA_TOKENLEN 36
337 +#define ORANGE_GFX "/orange_token.gfx"
338 +#define GGADU_SMS_ORANGE_TOKENLEN 36
339 #define RESERVED_CHARS "!\"'()*+-.<>[]\\^_`{}|~\t#;/?:&=+,$% \r\n\v\x7f"
348 @@ -116,12 +116,12 @@
349 gchar *sender; /* free() me */
352 - gchar *idea_token; /* free() me */
353 - gchar *idea_pass; /* free() me */
354 + gchar *orange_token; /* free() me */
355 + gchar *orange_pass; /* free() me */
358 gpointer send_sms(SMS * message);
359 -gpointer send_IDEA_stage2(SMS * message);
360 +gpointer send_ORANGE_stage2(SMS * message);
362 void sms_message(const gchar * sms_number, const gchar * message);
363 void sms_warning(const gchar * sms_number, const gchar * warning);
364 diff -aurN gg2-2.2.8/src/plugins/sms/sms_gui.c gg2-2.2.8.cvs/src/plugins/sms/sms_gui.c
365 --- gg2-2.2.8/src/plugins/sms/sms_gui.c 2005-01-19 22:02:18.000000000 +0100
366 +++ gg2-2.2.8.cvs/src/plugins/sms/sms_gui.c 2005-09-24 05:43:21.000000000 +0200
372 * SMS plugin for GNU Gadu 2
375 GGaduPlugin *sms_handler;
376 GSList *smslist = NULL;
377 -gchar *idea_token_path = NULL;
378 +gchar *orange_token_path = NULL;
383 if (!ggadu_config_read(sms_handler))
384 g_warning(_("Unable to read config file for plugin sms"));
386 - idea_token_path = g_build_filename(config->configdir, IDEA_GFX, NULL);
387 + orange_token_path = g_build_filename(config->configdir, ORANGE_GFX, NULL);
389 register_signal_receiver((GGaduPlugin *) sms_handler, (signal_func_ptr) signal_receive);
391 @@ -479,11 +479,11 @@
393 GGaduKeyValue *kv = (GGaduKeyValue *) tmplist->data;
395 - message->idea_pass = g_strdup(kv->value);
396 + message->orange_pass = g_strdup(kv->value);
398 tmplist = tmplist->next;
400 - g_thread_create((gpointer(*)())send_IDEA_stage2, message, FALSE, NULL);
401 + g_thread_create((gpointer(*)())send_ORANGE_stage2, message, FALSE, NULL);
404 GGaduDialog_free(dialog);
406 signal_emit(GGadu_PLUGIN_NAME, "gui unregister protocol", p, "main-gui");
407 ggadu_menu_free(menu_smsmenu);
409 - g_free(idea_token_path);
410 + g_free(orange_token_path);
413 /* zapis listy numerow do pliku */