Mercurial > pidgin
annotate libpurple/protocols/msn/session.c @ 25575:d51b8647d43c
applied changes from 70fa4cc384b7643ab1f296bdc2399bc208542a20
through f0df27a299120baecf9ea88a9fb24ffe1dbe72fd
ChangeLog for the above
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Tue, 28 Apr 2009 20:55:35 +0000 |
parents | b1080a1a2cb0 |
children | 4b8c4870b13a |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file session.c MSN session functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
15822 | 6 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17579
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "msn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 #include "session.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 #include "notification.h" |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20533
diff
changeset
|
27 #include "oim.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "dialog.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 MsnSession * |
15822 | 32 msn_session_new(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 MsnSession *session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 g_return_val_if_fail(account != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 session = g_new0(MsnSession, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 session->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 session->notification = msn_notification_new(session); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 session->userlist = msn_userlist_new(session); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 session->user = msn_user_new(session->userlist, |
15822 | 45 purple_account_get_username(account), NULL); |
20534
7e69275a4eef
oim migrated to new soap code, quadruply duplicated message!
Ka-Hing Cheung <khc@hxbc.us>
parents:
20533
diff
changeset
|
46 session->oim = msn_oim_new(session); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
48 session->protocol_ver = WLM_PROT_VER; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 return session; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 msn_session_destroy(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 g_return_if_fail(session != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 session->destroying = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
23690
107166bb2a64
I guess I re-arranged a little off. We probably should disconnect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23676
diff
changeset
|
60 if (session->connected) |
107166bb2a64
I guess I re-arranged a little off. We probably should disconnect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23676
diff
changeset
|
61 msn_session_disconnect(session); |
107166bb2a64
I guess I re-arranged a little off. We probably should disconnect
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23676
diff
changeset
|
62 |
23676
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
63 if (session->soap_cleanup_handle) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
64 purple_timeout_remove(session->soap_cleanup_handle); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
65 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
66 if (session->soap_table != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
67 g_hash_table_destroy(session->soap_table); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
68 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
69 while (session->slplinks != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
70 msn_slplink_destroy(session->slplinks->data); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
71 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
72 while (session->switches != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
73 msn_switchboard_destroy(session->switches->data); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
74 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
75 if (session->sync != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
76 msn_sync_destroy(session->sync); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
77 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
78 if (session->oim != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
79 msn_oim_destroy(session->oim); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
80 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
81 if (session->nexus != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
82 msn_nexus_destroy(session->nexus); |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
83 |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
84 if (session->user != NULL) |
8552b19acbce
Re-arrange msn_session_destroy to avoid use-after-free bugs. I don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23675
diff
changeset
|
85 msn_user_destroy(session->user); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 if (session->notification != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 msn_notification_destroy(session->notification); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 msn_userlist_destroy(session->userlist); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
21791 | 92 g_free(session->psm); |
25458
b1080a1a2cb0
Save and use the CacheKey for ABCH SOAP requests.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25456
diff
changeset
|
93 g_free(session->abch_cachekey); |
25456
201789d2f003
Comment out this extra string until we need it (if ever).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24755
diff
changeset
|
94 #if 0 |
23477
fd124c21ebb7
Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23468
diff
changeset
|
95 g_free(session->blocked_text); |
25456
201789d2f003
Comment out this extra string until we need it (if ever).
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24755
diff
changeset
|
96 #endif |
23477
fd124c21ebb7
Properly parse (most of) the MSN GCF command. Provides a
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23468
diff
changeset
|
97 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 g_free(session->passport_info.kv); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 g_free(session->passport_info.sid); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 g_free(session->passport_info.mspauth); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 g_free(session->passport_info.client_ip); |
23612
7f4b697c6947
Use a URL to open MSN Hotmail inbox instead of a temporary file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23554
diff
changeset
|
102 g_free(session->passport_info.mail_url); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 g_free(session); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 msn_session_connect(MsnSession *session, const char *host, int port, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 gboolean http_method) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 g_return_val_if_fail(session != NULL, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 g_return_val_if_fail(!session->connected, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 session->connected = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 session->http_method = http_method; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 if (session->notification == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 { |
15822 | 119 purple_debug_error("msn", "This shouldn't happen\n"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 g_return_val_if_reached(FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 |
24385
5b5c21b60690
Get rid of an unnecessary if statement, and don't try to unref a
Mark Doliner <mark@kingant.net>
parents:
23690
diff
changeset
|
123 return msn_notification_connect(session->notification, host, port); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 msn_session_disconnect(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 g_return_if_fail(session != NULL); |
20766
5beeb2e546c2
Prevent an assertion (w/ G_DEBUG=fatal_warnings) when the connection drops.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20589
diff
changeset
|
130 |
5beeb2e546c2
Prevent an assertion (w/ G_DEBUG=fatal_warnings) when the connection drops.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20589
diff
changeset
|
131 if (!session->connected) |
5beeb2e546c2
Prevent an assertion (w/ G_DEBUG=fatal_warnings) when the connection drops.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20589
diff
changeset
|
132 return; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 session->connected = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 while (session->switches != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 msn_switchboard_close(session->switches->data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 if (session->notification != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 msn_notification_close(session->notification); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 /* TODO: This must go away when conversation is redesigned */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 MsnSwitchBoard * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 msn_session_find_swboard(MsnSession *session, const char *username) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
147 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 g_return_val_if_fail(username != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 for (l = session->switches; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 MsnSwitchBoard *swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 swboard = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 if ((swboard->im_user != NULL) && !strcmp(username, swboard->im_user)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 return swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
20433
df8f443ae65f
use serv_got_im to report received oim's
Stu Tomlinson <stu@nosnilmot.com>
parents:
20432
diff
changeset
|
165 static PurpleConversation * |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
166 msn_session_get_conv(MsnSession *session,const char *passport) |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
167 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
168 PurpleAccount *account; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
169 PurpleConversation * conv; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
170 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
171 g_return_val_if_fail(session != NULL, NULL); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
172 account = session->account; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
173 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
174 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
175 passport, account); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
176 if(conv == NULL){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
177 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, passport); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
178 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
179 return conv; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
180 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
181 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
182 /* put Message to User Conversation |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
183 * |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
184 * passport - the one want to talk to you |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
185 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
186 void |
23490
fd276936164f
Make errors when sending OIM's more visible.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23477
diff
changeset
|
187 msn_session_report_user(MsnSession *session,const char *passport,const char *msg,PurpleMessageFlags flags) |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
188 { |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
189 PurpleConversation * conv; |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
190 |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
191 if ((conv = msn_session_get_conv(session,passport)) != NULL){ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
192 purple_conversation_write(conv, NULL, msg, flags, time(NULL)); |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
193 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
194 } |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
195 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 MsnSwitchBoard * |
15822 | 197 msn_session_find_swboard_with_conv(MsnSession *session, PurpleConversation *conv) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
199 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 g_return_val_if_fail(conv != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
204 for (l = session->switches; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 MsnSwitchBoard *swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 swboard = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 if (swboard->conv == conv) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 return swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 MsnSwitchBoard * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 msn_session_find_swboard_with_id(const MsnSession *session, int chat_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 g_return_val_if_fail(chat_id >= 0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 for (l = session->switches; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 MsnSwitchBoard *swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 swboard = l->data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 if (swboard->chat_id == chat_id) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 return swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 MsnSwitchBoard * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 msn_session_get_swboard(MsnSession *session, const char *username, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 MsnSBFlag flag) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 MsnSwitchBoard *swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 g_return_val_if_fail(session != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 swboard = msn_session_find_swboard(session, username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 if (swboard == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 swboard = msn_switchboard_new(session); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 swboard->im_user = g_strdup(username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 msn_switchboard_request(swboard); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 msn_switchboard_request_add_user(swboard, username); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 swboard->flag |= flag; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 return swboard; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 msn_session_sync_users(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 { |
15822 | 264 PurpleBlistNode *gnode, *cnode, *bnode; |
265 PurpleConnection *gc = purple_account_get_connection(session->account); | |
22927
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
266 GList *to_remove = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 g_return_if_fail(gc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 /* The core used to use msn_add_buddy to add all buddies before |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 * being logged in. This no longer happens, so we manually iterate |
20589
5723dbc6212d
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20514
diff
changeset
|
272 * over the whole buddy list to identify sync issues. |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
273 */ |
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
274 for (gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { |
15822 | 275 PurpleGroup *group = (PurpleGroup *)gnode; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20434
diff
changeset
|
276 const char *group_name; |
15822 | 277 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 continue; |
20439
bee467c81570
A bunch of MSNP14 stuff:
Stu Tomlinson <stu@nosnilmot.com>
parents:
20434
diff
changeset
|
279 group_name = group->name; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
15822 | 281 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
15822 | 284 PurpleBuddy *b; |
285 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 continue; |
15822 | 287 b = (PurpleBuddy *)bnode; |
288 if(purple_buddy_get_account(b) == purple_connection_get_account(gc)) { | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 MsnUser *remote_user; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 gboolean found = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 |
15822 | 292 remote_user = msn_userlist_find_user(session->userlist, purple_buddy_get_name(b)); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 if ((remote_user != NULL) && (remote_user->list_op & MSN_LIST_FL_OP)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 GList *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 for (l = remote_user->group_ids; l != NULL; l = l->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 { |
20504
d23c3a5884ee
Make the buddylist sync issue a little less worse.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20481
diff
changeset
|
300 const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data); |
d23c3a5884ee
Make the buddylist sync issue a little less worse.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20481
diff
changeset
|
301 if (name && !g_strcasecmp(group_name, name)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 found = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 |
22927
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
309 /* We don't care if they're in a different group, as long as they're on the |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
310 * list somewhere. If we check for the group, we cause pain, agony and |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
311 * suffering for people who decide to re-arrange their buddy list elsewhere. |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
312 */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 if (!found) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 { |
22927
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
315 if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) { |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
316 /* The user is not on the server list */ |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
317 msn_show_sync_issue(session, purple_buddy_get_name(b), group_name); |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
318 } else { |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
319 /* The user is not in that group on the server list */ |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
320 to_remove = g_list_prepend(to_remove, b); |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
321 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 } |
22927
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
327 |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
328 if (to_remove != NULL) { |
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
329 g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL); |
22929
09cab27cbe42
unleak (thanks sadrul!)
Stu Tomlinson <stu@nosnilmot.com>
parents:
22927
diff
changeset
|
330 g_list_free(to_remove); |
22927
25e4a0add118
Make MSN buddy list synchronization more forgiving, only ask about
Stu Tomlinson <stu@nosnilmot.com>
parents:
22043
diff
changeset
|
331 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 msn_session_set_error(MsnSession *session, MsnErrorType error, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 const char *info) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 { |
15822 | 338 PurpleConnection *gc; |
21358 | 339 PurpleConnectionError reason; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 char *msg; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 |
23675
da592864cae2
Don't try to report a connection error if the MSN session is being
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23612
diff
changeset
|
342 if (session->destroying) |
da592864cae2
Don't try to report a connection error if the MSN session is being
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23612
diff
changeset
|
343 return; |
da592864cae2
Don't try to report a connection error if the MSN session is being
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23612
diff
changeset
|
344 |
15822 | 345 gc = purple_account_get_connection(session->account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
347 switch (error) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 case MSN_ERROR_SERVCONN: |
21358 | 350 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
351 msg = g_strdup(info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 case MSN_ERROR_UNSUPPORTED_PROTOCOL: |
21358 | 354 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 msg = g_strdup(_("Our protocol is not supported by the " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 "server.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 case MSN_ERROR_HTTP_MALFORMED: |
21358 | 359 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 msg = g_strdup(_("Error parsing HTTP.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
362 case MSN_ERROR_SIGN_OTHER: |
21358 | 363 reason = PURPLE_CONNECTION_ERROR_NAME_IN_USE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 msg = g_strdup(_("You have signed on from another location.")); |
20589
5723dbc6212d
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20514
diff
changeset
|
365 if (!purple_account_get_remember_password(session->account)) |
5723dbc6212d
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
20514
diff
changeset
|
366 purple_account_set_password(session->account, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
367 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 case MSN_ERROR_SERV_UNAVAILABLE: |
21358 | 369 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 msg = g_strdup(_("The MSN servers are temporarily " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 "unavailable. Please wait and try " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 "again.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 case MSN_ERROR_SERV_DOWN: |
21358 | 375 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 msg = g_strdup(_("The MSN servers are going down " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 "temporarily.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 case MSN_ERROR_AUTH: |
21358 | 380 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 msg = g_strdup_printf(_("Unable to authenticate: %s"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 (info == NULL ) ? |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 _("Unknown error") : info); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
385 case MSN_ERROR_BAD_BLIST: |
21358 | 386 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 msg = g_strdup(_("Your MSN buddy list is temporarily " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 "unavailable. Please wait and try " |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 "again.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 default: |
21358 | 392 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 msg = g_strdup(_("Unknown error.")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 msn_session_disconnect(session); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 |
20120
557c4c67bd29
Use purple_connection_error_reason in prpl-msn.
Will Thompson <will.thompson@collabora.co.uk>
parents:
19681
diff
changeset
|
399 purple_connection_error_reason (gc, reason, msg); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 g_free(msg); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 static const char * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 get_login_step_text(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 const char *steps_text[] = { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 _("Connecting"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 _("Handshaking"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 _("Transferring"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 _("Handshaking"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 _("Starting authentication"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 _("Getting cookie"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 _("Authenticating"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 _("Sending cookie"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 _("Retrieving buddy list") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 return steps_text[session->login_step]; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 msn_session_set_login_step(MsnSession *session, MsnLoginStep step) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 { |
15822 | 425 PurpleConnection *gc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 /* Prevent the connection progress going backwards, eg. if we get |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 * transferred several times during login */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 if (session->login_step > step) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 /* If we're already logged in, we're probably here because of a |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 * mid-session XFR from the notification server, so we don't want to |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 * popup the connection progress dialog */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 if (session->logged_in) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 gc = session->account->gc; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 session->login_step = step; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
15822 | 442 purple_connection_update_progress(gc, get_login_step_text(session), step, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 MSN_LOGIN_STEPS); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
444 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
446 void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
447 msn_session_finish_login(MsnSession *session) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
448 { |
15822 | 449 PurpleAccount *account; |
450 PurpleConnection *gc; | |
16390
4fc51a87ce42
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
451 PurpleStoredImage *img; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
452 |
24755
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
453 if (!session->logged_in) { |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
454 account = session->account; |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
455 gc = purple_account_get_connection(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
456 |
24755
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
457 img = purple_buddy_icons_find_account_icon(session->account); |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
458 /* TODO: Do we really want to call this if img is NULL? */ |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
459 msn_user_set_buddy_icon(session->user, img); |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
460 if (img != NULL) |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
461 purple_imgstore_unref(img); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 |
24755
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
463 session->logged_in = TRUE; |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
464 purple_connection_set_state(gc, PURPLE_CONNECTED); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 |
24755
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
466 /* Sync users */ |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
467 msn_session_sync_users(session); |
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
468 } |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 |
24755
39bd04a550a4
Actually that last change did break regular login, but I don't feel like
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24753
diff
changeset
|
470 msn_change_status(session); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
471 } |
20394
4a099e4d0d09
propagate from branch 'im.pidgin.pidgin' (head 98b6b547b29ea1192b73cc4e1de1e674edef4328)
Richard Laager <rlaager@wiktel.com>
parents:
15822
diff
changeset
|
472 |