Mercurial > pidgin
annotate libpurple/protocols/yahoo/libymsg.c @ 32038:8d3b5853b017
xmlnode: Add xmlnode_strip_prefixes
This is largely based on a patch from Thijs (sphynx/xnyhps) Alkemade, with
some modifications by me to try to maintain namespaces of elements
as best as we can.
I also rewrote xmlnode_get_default_namespace not to use recursion.
References #14529
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sun, 04 Sep 2011 21:06:26 +0000 |
parents | cd1d9e04c587 |
children | 75d20c9836c1 |
rev | line source |
---|---|
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2 * purple |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4 * Purple is the legal property of its developers, whose names are too numerous |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5 * to list here. Please refer to the COPYRIGHT file distributed with this |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
6 * source distribution. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
7 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
8 * This program is free software; you can redistribute it and/or modify |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
11 * (at your option) any later version. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
12 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
13 * This program is distributed in the hope that it will be useful, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
16 * GNU General Public License for more details. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
17 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
18 * You should have received a copy of the GNU General Public License |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
19 * along with this program; if not, write to the Free Software |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
21 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
22 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
23 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
24 #include "internal.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
25 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
26 #include "account.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
27 #include "accountopt.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
28 #include "blist.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
29 #include "cipher.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
30 #include "cmds.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
31 #include "core.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
32 #include "debug.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
33 #include "network.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
34 #include "notify.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
35 #include "privacy.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
36 #include "prpl.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
37 #include "proxy.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
38 #include "request.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
39 #include "server.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
40 #include "util.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
41 #include "version.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
42 #include "xmlnode.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
43 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
44 #include "libymsg.h" |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
45 #include "yahoochat.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
46 #include "yahoo_aliases.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
47 #include "yahoo_doodle.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
48 #include "yahoo_filexfer.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
49 #include "yahoo_friend.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
50 #include "yahoo_packet.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
51 #include "yahoo_picture.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
52 #include "ycht.h" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
53 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
54 /* #define YAHOO_DEBUG */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
55 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
56 /* #define TRY_WEBMESSENGER_LOGIN 0 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
57 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
58 /* One hour */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
59 #define PING_TIMEOUT 3600 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
60 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
61 /* One minute */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
62 #define KEEPALIVE_TIMEOUT 60 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
63 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
64 #ifdef TRY_WEBMESSENGER_LOGIN |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
65 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
66 #endif /* TRY_WEBMESSENGER_LOGIN */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
67 |
27319
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
68 static gboolean yahoo_is_japan(PurpleAccount *account) |
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
69 { |
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
70 return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp"); |
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
71 } |
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
72 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
73 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
74 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
75 char *status = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
76 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
77 if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
78 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
79 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
80 switch (f->status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
81 case YAHOO_STATUS_OFFLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
82 status = YAHOO_STATUS_TYPE_OFFLINE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
83 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
84 case YAHOO_STATUS_AVAILABLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
85 status = YAHOO_STATUS_TYPE_AVAILABLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
86 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
87 case YAHOO_STATUS_BRB: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
88 status = YAHOO_STATUS_TYPE_BRB; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
89 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
90 case YAHOO_STATUS_BUSY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
91 status = YAHOO_STATUS_TYPE_BUSY; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
92 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
93 case YAHOO_STATUS_NOTATHOME: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
94 status = YAHOO_STATUS_TYPE_NOTATHOME; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
95 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
96 case YAHOO_STATUS_NOTATDESK: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
97 status = YAHOO_STATUS_TYPE_NOTATDESK; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
98 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
99 case YAHOO_STATUS_NOTINOFFICE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
100 status = YAHOO_STATUS_TYPE_NOTINOFFICE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
101 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
102 case YAHOO_STATUS_ONPHONE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
103 status = YAHOO_STATUS_TYPE_ONPHONE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
104 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
105 case YAHOO_STATUS_ONVACATION: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
106 status = YAHOO_STATUS_TYPE_ONVACATION; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
107 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
108 case YAHOO_STATUS_OUTTOLUNCH: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
109 status = YAHOO_STATUS_TYPE_OUTTOLUNCH; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
110 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
111 case YAHOO_STATUS_STEPPEDOUT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
112 status = YAHOO_STATUS_TYPE_STEPPEDOUT; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
113 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
114 case YAHOO_STATUS_INVISIBLE: /* this should never happen? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
115 status = YAHOO_STATUS_TYPE_INVISIBLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
116 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
117 case YAHOO_STATUS_CUSTOM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
118 case YAHOO_STATUS_IDLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
119 if (!f->away) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
120 status = YAHOO_STATUS_TYPE_AVAILABLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
121 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
122 status = YAHOO_STATUS_TYPE_AWAY; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
123 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
124 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
125 purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
126 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
127 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
128 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
129 if (status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
130 if (f->status == YAHOO_STATUS_CUSTOM) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
131 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
132 yahoo_friend_get_status_message(f), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
133 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
134 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
135 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
136 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
137 if (f->idle != 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
138 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
139 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
140 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
141 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
142 if (f->sms) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
143 purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
144 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
145 purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
146 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
147 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
148 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
149 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
150 PurpleAccount *account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
151 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
152 YahooFriend *f = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
153 char *name = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
154 gboolean unicode = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
155 char *message = NULL; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
156 YahooFederation fed = YAHOO_FEDERATION_NONE; |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
157 char *fedname = NULL; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
158 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
159 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
160 if (!purple_account_get_remember_password(account)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
161 purple_account_set_password(account, NULL); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
162 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
163 _("You have signed on from another location")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
164 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
165 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
166 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
167 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
168 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
169 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
170 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
171 case 0: /* we won't actually do anything with this */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
172 case 1: /* we won't actually do anything with this */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
173 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
174 case 8: /* how many online buddies we have */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
175 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
176 case 7: /* the current buddy */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
177 /* update the previous buddy before changing the variables */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
178 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
179 if (message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
180 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
181 if (name) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
182 yahoo_update_status(gc, name, f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
183 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
184 name = message = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
185 f = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
186 if (pair->value && g_utf8_validate(pair->value, -1, NULL)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
187 GSList *tmplist; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
188 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
189 name = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
190 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
191 /* Look ahead to see if we have the federation info about the buddy */ |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
192 for (tmplist = l->next; tmplist; tmplist = tmplist->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
193 struct yahoo_pair *p = tmplist->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
194 if (p->key == 7) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
195 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
196 if (p->key == 241) { |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
197 fed = strtol(p->value, NULL, 10); |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
198 g_free(fedname); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
199 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
200 case YAHOO_FEDERATION_MSN: |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
201 name = fedname = g_strconcat("msn/", name, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
202 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
203 case YAHOO_FEDERATION_OCS: |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
204 name = fedname = g_strconcat("ocs/", name, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
205 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
206 case YAHOO_FEDERATION_IBM: |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
207 name = fedname = g_strconcat("ibm/", name, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
208 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
209 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
210 default: |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
211 fedname = NULL; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
212 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
213 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
214 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
215 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
216 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
217 f = yahoo_friend_find_or_new(gc, name); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
218 f->fed = fed; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
219 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
220 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
221 case 10: /* state */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
222 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
223 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
224 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
225 f->status = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
226 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
227 f->away = 1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
228 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
229 f->away = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
230 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
231 if (f->status == YAHOO_STATUS_IDLE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
232 /* Idle may have already been set in a more precise way in case 137 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
233 if (f->idle == 0) |
28240
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
234 { |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
235 if(pkt->service == YAHOO_SERVICE_STATUS_15) |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
236 f->idle = -1; |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
237 else |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
238 f->idle = time(NULL); |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
239 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
240 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
241 f->idle = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
242 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
243 if (f->status != YAHOO_STATUS_CUSTOM) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
244 yahoo_friend_set_status_message(f, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
245 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
246 f->sms = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
247 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
248 case 19: /* custom message */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
249 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
250 message = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
251 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
252 case 11: /* this is the buddy's session id */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
253 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
254 f->session_id = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
255 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
256 case 17: /* in chat? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
257 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
258 case 47: /* is custom status away or not? 2=idle*/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
259 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
260 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
261 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
262 /* I have no idea what it means when this is |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
263 * set when someone's available, but it doesn't |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
264 * mean idle. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
265 if (f->status == YAHOO_STATUS_AVAILABLE) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
266 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
267 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
268 f->away = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
269 if (f->away == 2) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
270 /* Idle may have already been set in a more precise way in case 137 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
271 if (f->idle == 0) |
28240
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
272 { |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
273 if(pkt->service == YAHOO_SERVICE_STATUS_15) |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
274 f->idle = -1; |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
275 else |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
276 f->idle = time(NULL); |
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
277 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
278 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
279 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
280 break; |
28240
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
281 case 138: /* when value is 1, either we're not idle, or we are but won't say how long */ |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
282 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
283 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
284 |
28240
860998956a4d
Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28239
diff
changeset
|
285 if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) ) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
286 f->idle = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
287 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
288 case 137: /* usually idle time in seconds, sometimes login time */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
289 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
290 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
291 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
292 if (f->status != YAHOO_STATUS_AVAILABLE) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
293 f->idle = time(NULL) - strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
294 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
295 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
296 if (strtol(pair->value, NULL, 10) == 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
297 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
298 f->status = YAHOO_STATUS_OFFLINE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
299 if (name) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
300 purple_prpl_got_user_status(account, name, "offline", NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
301 purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
302 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
303 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
304 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
305 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
306 case 60: /* SMS */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
307 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
308 f->sms = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
309 yahoo_update_status(gc, name, f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
310 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
311 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
312 case 197: /* Avatars */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
313 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
314 guchar *decoded; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
315 char *tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
316 gsize len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
317 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
318 if (pair->value) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
319 decoded = purple_base64_decode(pair->value, &len); |
30616
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
320 if (decoded && len > 0) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
321 tmp = purple_str_binary_to_ascii(decoded, len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
322 purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
323 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
324 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
325 g_free(decoded); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
326 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
327 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
328 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
329 case 192: /* Pictures, aka Buddy Icons, checksum */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
330 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
331 /* FIXME: Please, if you know this protocol, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
332 * FIXME: fix up the strtol() stuff if possible. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
333 int cksum = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
334 const char *locksum = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
335 PurpleBuddy *b; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
336 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
337 if (!name) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
338 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
339 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
340 b = purple_find_buddy(gc->account, name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
341 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
342 if (!cksum || (cksum == -1)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
343 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
344 yahoo_friend_set_buddy_icon_need_request(f, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
345 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
346 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
347 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
348 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
349 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
350 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
351 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
352 yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
353 if (b) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
354 locksum = purple_buddy_icons_get_checksum_for_user(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
355 if (!locksum || (cksum != strtol(locksum, NULL, 10))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
356 yahoo_send_picture_request(gc, name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
357 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
358 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
359 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
360 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
361 case 16: /* Custom error message */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
362 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
363 char *tmp = yahoo_string_decode(gc, pair->value, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
364 purple_notify_error(gc, NULL, tmp, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
365 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
366 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
367 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
368 case 97: /* Unicode status message */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
369 unicode = !strcmp(pair->value, "1"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
370 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
371 case 244: /* client version number. Yahoo Client Detection */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
372 if(f && strtol(pair->value, NULL, 10)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
373 f->version_id = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
374 break; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
375 case 241: /* Federated network buddy belongs to */ |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
376 break; /* We process this when get '7' */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
377 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
378 purple_debug_warning("yahoo", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
379 "Unknown status key %d\n", pair->key); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
380 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
381 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
382 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
383 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
384 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
385 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
386 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
387 if (pkt->service == YAHOO_SERVICE_LOGOFF) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
388 f->status = YAHOO_STATUS_OFFLINE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
389 if (message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
390 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
391 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
392 if (name) /* update the last buddy */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
393 yahoo_update_status(gc, name, f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
394 } |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
395 |
28456
380c77dad7b4
Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28425
diff
changeset
|
396 g_free(fedname); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
397 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
398 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
399 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
400 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
401 PurpleBuddy *b; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
402 PurpleGroup *g; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
403 GSList *list, *i; |
30204 | 404 gboolean onlist = FALSE; |
30209
c4cbe5f992ce
Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
30204
diff
changeset
|
405 char *oname = NULL; |
30204 | 406 |
30214
3ae0814ae727
So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30210
diff
changeset
|
407 if (g_hash_table_lookup_extended(ht, name, (gpointer *)&oname, (gpointer *)&list)) |
3ae0814ae727
So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30210
diff
changeset
|
408 g_hash_table_steal(ht, oname); |
30204 | 409 else |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
410 list = purple_find_buddies(account, name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
411 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
412 for (i = list; i; i = i->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
413 b = i->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
414 g = purple_buddy_get_group(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
415 if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
416 purple_debug_misc("yahoo", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
417 "Oh good, %s is in the right group (%s).\n", name, group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
418 list = g_slist_delete_link(list, i); |
30204 | 419 onlist = TRUE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
420 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
421 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
422 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
423 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
424 if (!onlist) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
425 purple_debug_misc("yahoo", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
426 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
427 if (!(g = purple_find_group(group))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
428 g = purple_group_new(group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
429 purple_blist_add_group(g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
430 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
431 b = purple_buddy_new(account, name, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
432 purple_blist_add_buddy(b, NULL, g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
433 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
434 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
435 if (list) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
436 if (!oname) |
30214
3ae0814ae727
So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30210
diff
changeset
|
437 oname = g_strdup(name); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
438 g_hash_table_insert(ht, oname, list); |
30204 | 439 } else |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
440 g_free(oname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
441 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
442 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
443 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
444 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
445 char *name = key; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
446 GSList *list = value, *i; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
447 PurpleBuddy *b; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
448 PurpleGroup *g; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
449 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
450 for (i = list; i; i = i->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
451 b = i->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
452 g = purple_buddy_get_group(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
453 purple_debug_misc("yahoo", "Deleting Buddy %s from group %s.\n", name, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
454 purple_group_get_name(g)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
455 purple_blist_remove_buddy(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
456 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
457 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
458 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
459 static char *_getcookie(char *rawcookie) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
460 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
461 char *cookie = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
462 char *tmpcookie; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
463 char *cookieend; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
464 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
465 if (strlen(rawcookie) < 2) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
466 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
467 tmpcookie = g_strdup(rawcookie+2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
468 cookieend = strchr(tmpcookie, ';'); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
469 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
470 if (cookieend) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
471 *cookieend = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
472 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
473 cookie = g_strdup(tmpcookie); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
474 g_free(tmpcookie); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
475 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
476 return cookie; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
477 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
478 |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
479 static void yahoo_process_cookie(YahooData *yd, char *c) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
480 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
481 if (c[0] == 'Y') { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
482 if (yd->cookie_y) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
483 g_free(yd->cookie_y); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
484 yd->cookie_y = _getcookie(c); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
485 } else if (c[0] == 'T') { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
486 if (yd->cookie_t) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
487 g_free(yd->cookie_t); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
488 yd->cookie_t = _getcookie(c); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
489 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
490 purple_debug_info("yahoo", "Unrecognized cookie '%c'\n", c[0]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
491 yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
492 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
493 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
494 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
495 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
496 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
497 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
498 PurpleAccount *account = purple_connection_get_account(gc); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
499 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
500 GHashTable *ht; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
501 char *norm_bud = NULL; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
502 char *temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
503 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
504 /* But what if you had no friends? */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
505 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
506 int stealth = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
507 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
508 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
509 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
510 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
511 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
512 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
513 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
514 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
515 case 302: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
516 /* This is always 318 before a group, 319 before the first s/n in a group, 320 before any ignored s/n. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
517 * It is not sent for s/n's in a group after the first. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
518 * All ignored s/n's are listed last, so when we see a 320 we clear the group and begin marking the |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
519 * s/n's as ignored. It is always followed by an identical 300 key. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
520 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
521 if (pair->value && !strcmp(pair->value, "320")) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
522 /* No longer in any group; this indicates the start of the ignore list. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
523 g_free(yd->current_list15_grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
524 yd->current_list15_grp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
525 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
526 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
527 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
528 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
529 if(temp != NULL) { |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
530 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
531 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
532 norm_bud = g_strconcat("msn/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
533 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
534 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
535 norm_bud = g_strconcat("ocs/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
536 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
537 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
538 norm_bud = g_strconcat("ibm/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
539 break; |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
540 case YAHOO_FEDERATION_PBX: |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
541 norm_bud = g_strconcat("pbx/", temp, NULL); |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
542 break; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
543 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
544 norm_bud = g_strdup(temp); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
545 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
546 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
547 if (yd->current_list15_grp) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
548 /* This buddy is in a group */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
549 f = yahoo_friend_find_or_new(gc, norm_bud); |
30413
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
550 if (!purple_find_buddy(account, norm_bud)) { |
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
551 PurpleBuddy *b; |
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
552 PurpleGroup *g; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
553 if (!(g = purple_find_group(yd->current_list15_grp))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
554 g = purple_group_new(yd->current_list15_grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
555 purple_blist_add_group(g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
556 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
557 b = purple_buddy_new(account, norm_bud, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
558 purple_blist_add_buddy(b, NULL, g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
559 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
560 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
561 if(fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
562 f->fed = fed; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
563 purple_debug_info("yahoo", "Setting federation to %d\n", f->fed); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
564 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
565 if(stealth == 2) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
566 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
567 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
568 /* set p2p status not connected and no p2p packet sent */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
569 if(fed == YAHOO_FEDERATION_NONE) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
570 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
571 f->p2p_packet_sent = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
572 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
573 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
574 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
575 /* This buddy is on the ignore list (and therefore in no group) */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
576 purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
577 purple_privacy_deny_add(account, norm_bud, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
578 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
579 |
27822
44930be7114b
Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <mark@kingant.net>
parents:
27799
diff
changeset
|
580 g_free(norm_bud); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
581 norm_bud=NULL; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
582 fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
583 stealth = 0; |
27822
44930be7114b
Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <mark@kingant.net>
parents:
27799
diff
changeset
|
584 g_free(temp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
585 temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
586 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
587 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
588 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
589 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
590 case 65: /* This is the group */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
591 g_free(yd->current_list15_grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
592 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
593 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
594 case 7: /* buddy's s/n */ |
27822
44930be7114b
Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <mark@kingant.net>
parents:
27799
diff
changeset
|
595 g_free(temp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
596 temp = g_strdup(purple_normalize(account, pair->value)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
597 break; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
598 case 241: /* user on federated network */ |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
599 fed = strtol(pair->value, NULL, 10); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
600 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
601 case 59: /* somebody told cookies come here too, but im not sure */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
602 yahoo_process_cookie(yd, pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
603 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
604 case 317: /* Stealth Setting */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
605 stealth = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
606 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
607 /* case 242: */ /* this seems related to 241 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
608 /* break; */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
609 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
610 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
611 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
612 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
613 |
27672
05331a8eafb3
Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27639
diff
changeset
|
614 /* The reporter of ticket #9745 determined that we weren't retrieving the |
05331a8eafb3
Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27639
diff
changeset
|
615 * aliases during buddy list retrieval, so we never updated aliases that |
05331a8eafb3
Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27639
diff
changeset
|
616 * changed while we were signed off. */ |
05331a8eafb3
Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27639
diff
changeset
|
617 yahoo_fetch_aliases(gc); |
05331a8eafb3
Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27639
diff
changeset
|
618 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
619 /* Now that we have processed the buddy list, we can say yahoo has connected */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
620 purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account))); |
27639
482a5edc4799
kevin_BB on irc was reporting that doing things on connect didn't work,
Ka-Hing Cheung <khc@hxbc.us>
parents:
27603
diff
changeset
|
621 yd->logged_in = TRUE; |
482a5edc4799
kevin_BB on irc was reporting that doing things on connect didn't work,
Ka-Hing Cheung <khc@hxbc.us>
parents:
27603
diff
changeset
|
622 purple_debug_info("yahoo","Authentication: Connection established\n"); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
623 purple_connection_set_state(gc, PURPLE_CONNECTED); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
624 if (yd->picture_upload_todo) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
625 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
626 yd->picture_upload_todo = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
627 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
628 yahoo_set_status(account, purple_account_get_active_status(account)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
629 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
630 g_hash_table_destroy(ht); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
631 g_free(temp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
632 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
633 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
634 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
635 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
636 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
637 gboolean export = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
638 gboolean got_serv_list = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
639 YahooFriend *f = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
640 PurpleAccount *account = purple_connection_get_account(gc); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
641 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
642 GHashTable *ht; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
643 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
644 char **lines; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
645 char **split; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
646 char **buddies; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
647 char **tmp, **bud, *norm_bud; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
648 char *grp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
649 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
650 if (pkt->id) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
651 yd->session_id = pkt->id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
652 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
653 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
654 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
655 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
656 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
657 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
658 case 87: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
659 if (!yd->tmp_serv_blist) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
660 yd->tmp_serv_blist = g_string_new(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
661 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
662 g_string_append(yd->tmp_serv_blist, pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
663 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
664 case 88: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
665 if (!yd->tmp_serv_ilist) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
666 yd->tmp_serv_ilist = g_string_new(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
667 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
668 g_string_append(yd->tmp_serv_ilist, pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
669 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
670 case 89: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
671 yd->profiles = g_strsplit(pair->value, ",", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
672 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
673 case 59: /* cookies, yum */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
674 yahoo_process_cookie(yd, pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
675 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
676 case YAHOO_SERVICE_PRESENCE_PERM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
677 if (!yd->tmp_serv_plist) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
678 yd->tmp_serv_plist = g_string_new(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
679 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
680 g_string_append(yd->tmp_serv_plist, pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
681 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
682 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
683 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
684 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
685 if (pkt->status != 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
686 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
687 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
688 if (yd->tmp_serv_blist) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
689 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
690 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
691 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
692 for (tmp = lines; *tmp; tmp++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
693 split = g_strsplit(*tmp, ":", 2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
694 if (!split) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
695 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
696 if (!split[0] || !split[1]) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
697 g_strfreev(split); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
698 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
699 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
700 grp = yahoo_string_decode(gc, split[0], FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
701 buddies = g_strsplit(split[1], ",", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
702 for (bud = buddies; bud && *bud; bud++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
703 norm_bud = g_strdup(purple_normalize(account, *bud)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
704 f = yahoo_friend_find_or_new(gc, norm_bud); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
705 |
30413
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
706 if (!purple_find_buddy(account, norm_bud)) { |
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
707 PurpleBuddy *b; |
7c871249318b
Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30327
diff
changeset
|
708 PurpleGroup *g; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
709 if (!(g = purple_find_group(grp))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
710 g = purple_group_new(grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
711 purple_blist_add_group(g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
712 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
713 b = purple_buddy_new(account, norm_bud, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
714 purple_blist_add_buddy(b, NULL, g, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
715 export = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
716 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
717 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
718 yahoo_do_group_check(account, ht, norm_bud, grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
719 /* set p2p status not connected and no p2p packet sent */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
720 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
721 f->p2p_packet_sent = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
722 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
723 g_free(norm_bud); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
724 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
725 g_strfreev(buddies); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
726 g_strfreev(split); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
727 g_free(grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
728 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
729 g_strfreev(lines); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
730 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
731 g_string_free(yd->tmp_serv_blist, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
732 yd->tmp_serv_blist = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
733 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
734 g_hash_table_destroy(ht); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
735 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
736 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
737 if (yd->tmp_serv_ilist) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
738 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
739 for (bud = buddies; bud && *bud; bud++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
740 /* The server is already ignoring the user */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
741 got_serv_list = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
742 purple_privacy_deny_add(account, *bud, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
743 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
744 g_strfreev(buddies); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
745 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
746 g_string_free(yd->tmp_serv_ilist, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
747 yd->tmp_serv_ilist = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
748 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
749 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
750 if (got_serv_list && |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
751 ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
752 (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
753 (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
754 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
755 account->perm_deny = PURPLE_PRIVACY_DENY_USERS; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
756 purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
757 account->username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
758 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
759 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
760 if (yd->tmp_serv_plist) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
761 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
762 for (bud = buddies; bud && *bud; bud++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
763 f = yahoo_friend_find(gc, *bud); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
764 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
765 purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
766 account->username, *bud); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
767 f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
768 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
769 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
770 g_strfreev(buddies); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
771 g_string_free(yd->tmp_serv_plist, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
772 yd->tmp_serv_plist = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
773 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
774 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
775 /* Now that we've got the list, request aliases */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
776 yahoo_fetch_aliases(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
777 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
778 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
779 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
780 static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
781 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
782 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
783 char *msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
784 char *from = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
785 char *stat = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
786 char *game = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
787 YahooFriend *f = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
788 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
789 gint val_11 = 0; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
790 YahooData *yd = purple_connection_get_protocol_data(gc); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
791 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
792 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
793 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
794 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
795 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
796 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
797 if (pair->key == 4 || pair->key == 1) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
798 from = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
799 if (pair->key == 49) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
800 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
801 if (pair->key == 13) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
802 stat = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
803 if (pair->key == 14) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
804 game = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
805 if (pair->key == 11) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
806 val_11 = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
807 if (pair->key == 241) |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
808 fed = strtol(pair->value, NULL, 10); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
809 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
810 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
811 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
812 if (!from || !msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
813 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
814 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
815 /* disconnect the peer if connected through p2p and sends wrong value for session id */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
816 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
817 purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
818 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
819 g_hash_table_remove(yd->peers, from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
820 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
821 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
822 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
823 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
824 && (purple_privacy_check(account, from))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
825 { |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
826 char *fed_from = from; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
827 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
828 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
829 fed_from = g_strconcat("msn/", from, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
830 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
831 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
832 fed_from = g_strconcat("ocs/", from, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
833 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
834 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
835 fed_from = g_strconcat("ibm/", from, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
836 break; |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
837 case YAHOO_FEDERATION_PBX: |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
838 fed_from = g_strconcat("pbx/", from, NULL); |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
839 break; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
840 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
841 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
842 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
843 } |
30209
c4cbe5f992ce
Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
30204
diff
changeset
|
844 |
31341
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
845 if (stat && *stat == '1') |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
846 serv_got_typing(gc, fed_from, 0, PURPLE_TYPING); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
847 else |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
848 serv_got_typing_stopped(gc, fed_from); |
30209
c4cbe5f992ce
Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
30204
diff
changeset
|
849 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
850 if (fed_from != from) |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
851 g_free(fed_from); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
852 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
853 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
854 PurpleBuddy *bud = purple_find_buddy(account, from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
855 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
856 if (!bud) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
857 purple_debug_warning("yahoo", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
858 "%s is playing a game, and doesn't want you to know.\n", from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
859 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
860 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
861 f = yahoo_friend_find(gc, from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
862 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
863 return; /* if they're not on the list, don't bother */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
864 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
865 yahoo_friend_set_game(f, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
866 |
31341
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
867 if (stat && *stat == '1') { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
868 yahoo_friend_set_game(f, game); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
869 if (bud) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
870 yahoo_update_status(gc, from, f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
871 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
872 } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
873 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
874 char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
875 purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
876 g_free(buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
877 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
878 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
879 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
880 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
881 struct _yahoo_im { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
882 char *from; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
883 char *active_id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
884 int time; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
885 int utf8; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
886 int buddy_icon; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
887 char *id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
888 char *msg; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
889 YahooFederation fed; |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
890 char *fed_from; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
891 }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
892 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
893 static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
894 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
895 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
896 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
897 struct _yahoo_im *sms = NULL; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
898 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
899 char *server_msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
900 char *m; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
901 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
902 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
903 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
904 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
905 while (l != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
906 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
907 if (pair->key == 4) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
908 sms = g_new0(struct _yahoo_im, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
909 sms->from = g_strdup_printf("+%s", pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
910 sms->time = time(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
911 sms->utf8 = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
912 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
913 if (pair->key == 14) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
914 if (sms) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
915 sms->msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
916 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
917 if (pair->key == 68) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
918 if(sms) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
919 g_hash_table_insert(yd->sms_carrier, g_strdup(sms->from), g_strdup(pair->value)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
920 if (pair->key == 16) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
921 server_msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
922 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
923 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
924 |
31341
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
925 if(!sms) { |
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
926 purple_debug_info("yahoo", "Received a malformed SMS packet!\n"); |
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
927 return; |
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
928 } |
d88f3153170b
Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
31086
diff
changeset
|
929 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
930 if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
931 if (server_msg) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
932 PurpleConversation *c; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
933 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms->from, account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
934 if (c == NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
935 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sms->from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
936 purple_conversation_write(c, NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
937 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
938 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
939 purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
940 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
941 g_free(sms->from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
942 g_free(sms); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
943 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
944 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
945 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
946 if (!sms->from || !sms->msg) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
947 g_free(sms); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
948 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
949 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
950 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
951 m = yahoo_string_decode(gc, sms->msg, sms->utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
952 serv_got_im(gc, sms->from, m, 0, sms->time); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
953 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
954 g_free(m); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
955 g_free(sms->from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
956 g_free(sms); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
957 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
958 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
959 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
960 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
961 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
962 PurpleAccount *account; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
963 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
964 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
965 GSList *list = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
966 struct _yahoo_im *im = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
967 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
968 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
969 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
970 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
971 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
972 while (l != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
973 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
974 if (pair->key == 4 || pair->key == 1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
975 im = g_new0(struct _yahoo_im, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
976 list = g_slist_append(list, im); |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
977 im->from = pair->value; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
978 im->time = time(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
979 im->utf8 = TRUE; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
980 im->fed = YAHOO_FEDERATION_NONE; |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
981 im->fed_from = g_strdup(im->from); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
982 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
983 if (im && pair->key == 5) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
984 im->active_id = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
985 if (pair->key == 97) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
986 if (im) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
987 im->utf8 = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
988 if (pair->key == 15) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
989 if (im) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
990 im->time = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
991 if (pair->key == 206) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
992 if (im) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
993 im->buddy_icon = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
994 if (pair->key == 14) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
995 if (im) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
996 im->msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
997 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
998 if (im && pair->key == 241) { |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
999 im->fed = strtol(pair->value, NULL, 10); |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1000 g_free(im->fed_from); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1001 switch (im->fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1002 case YAHOO_FEDERATION_MSN: |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1003 im->fed_from = g_strconcat("msn/",im->from, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1004 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1005 case YAHOO_FEDERATION_OCS: |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1006 im->fed_from = g_strconcat("ocs/",im->from, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1007 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1008 case YAHOO_FEDERATION_IBM: |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1009 im->fed_from = g_strconcat("ibm/",im->from, NULL); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1010 break; |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
1011 case YAHOO_FEDERATION_PBX: |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
1012 im->fed_from = g_strconcat("pbx/",im->from, NULL); |
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
1013 break; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1014 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1015 default: |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1016 im->fed_from = g_strdup(im->from); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1017 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1018 } |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1019 purple_debug_info("yahoo", "Message from federated (%d) buddy %s.\n", im->fed, im->fed_from); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1020 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1021 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1022 /* peer session id */ |
28424
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1023 if (im && (pair->key == 11)) { |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1024 /* disconnect the peer if connected through p2p and sends wrong value for session id */ |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
1025 if( (im->fed == YAHOO_FEDERATION_NONE) && (pkt_type == YAHOO_PKT_TYPE_P2P) |
28424
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1026 && (yd->session_id != strtol(pair->value, NULL, 10)) ) |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1027 { |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1028 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->fed_from); |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1029 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1030 g_hash_table_remove(yd->peers, im->fed_from); |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1031 g_free(im->fed_from); |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1032 g_free(im); |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1033 return; /* Not sure whether we should process remaining IMs in this packet */ |
c46819108809
Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28423
diff
changeset
|
1034 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1035 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1036 /* IMV key */ |
28425
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1037 if (im && pair->key == 63) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1038 { |
28425
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1039 /* Check for the Doodle IMV, no IMvironment for federated buddies */ |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1040 if (im->from != NULL && im->fed == YAHOO_FEDERATION_NONE) |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1041 { |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1042 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(pair->value)); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1043 |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1044 if (strstr(pair->value, "doodle;") != NULL) |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1045 { |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1046 PurpleWhiteboard *wb; |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1047 |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1048 if (!purple_privacy_check(account, im->from)) { |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1049 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1050 im->from); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1051 g_free(im->fed_from); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1052 g_free(im); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1053 return; |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1054 } |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1055 /* I'm not sure the following ever happens -DAA */ |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1056 wb = purple_whiteboard_get_session(account, im->from); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1057 |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1058 /* If a Doodle session doesn't exist between this user */ |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1059 if(wb == NULL) |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1060 { |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1061 doodle_session *ds; |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1062 wb = purple_whiteboard_create(account, im->from, |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1063 DOODLE_STATE_REQUESTED); |
32002
d5ddf2d1ee04
Update yahoo prpl to use purple_whiteboard_get_protocol_data() and purple_whiteboard_set_protocol_data().
andrew.victor@mxit.com
parents:
31998
diff
changeset
|
1064 ds = purple_whiteboard_get_protocol_data(wb); |
28425
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1065 ds->imv_key = g_strdup(pair->value); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1066 |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1067 yahoo_doodle_command_send_request(gc, im->from, pair->value); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1068 yahoo_doodle_command_send_ready(gc, im->from, pair->value); |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1069 } |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1070 } |
335062a2d305
Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28424
diff
changeset
|
1071 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1072 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1073 if (pair->key == 429) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1074 if (im) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1075 im->id = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1076 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1077 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1078 } else if (pkt->status == 2) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1079 purple_notify_error(gc, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1080 _("Your Yahoo! message did not get sent."), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1081 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1082 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1083 for (l = list; l; l = l->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1084 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1085 char *m, *m2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1086 im = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1087 |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1088 if (!im->fed_from || !im->msg) { |
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1089 g_free(im->fed_from); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1090 g_free(im); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1091 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1092 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1093 |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1094 if (!purple_privacy_check(account, im->fed_from)) { |
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1095 purple_debug_info("yahoo", "Message from %s dropped.\n", im->fed_from); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1096 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1097 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1098 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1099 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1100 * TODO: Is there anything else we should check when determining whether |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1101 * we should send an acknowledgement? |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1102 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1103 if (im->id != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1104 /* Send acknowledgement. If we don't do this then the official |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1105 * Yahoo Messenger client for Windows will send us the same |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1106 * message 7 seconds later as an offline message. This is true |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1107 * for at least version 9.0.0.2162 on Windows XP. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1108 struct yahoo_packet *pkt2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1109 pkt2 = yahoo_packet_new(YAHOO_SERVICE_MESSAGE_ACK, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1110 YAHOO_STATUS_AVAILABLE, pkt->id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1111 yahoo_packet_hash(pkt2, "ssisii", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1112 1, im->active_id, /* May not always be the connection's display name */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1113 5, im->from, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1114 302, 430, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1115 430, im->id, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1116 303, 430, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1117 450, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1118 yahoo_packet_send_and_free(pkt2, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1119 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1120 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1121 m = yahoo_string_decode(gc, im->msg, im->utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1122 /* This may actually not be necessary, but it appears |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1123 * that at least at one point some clients were sending |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1124 * "\r\n" as line delimiters, so we want to avoid double |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1125 * lines. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1126 m2 = purple_strreplace(m, "\r\n", "\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1127 g_free(m); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1128 m = m2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1129 purple_util_chrreplace(m, '\r', '\n'); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1130 if (!strcmp(m, "<ding>")) { |
29306 | 1131 PurpleConversation *conv = NULL; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1132 char *username; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1133 |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1134 username = g_markup_escape_text(im->fed_from, -1); |
29306 | 1135 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY, |
1136 username, account); | |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1137 purple_prpl_got_attention(gc, username, YAHOO_BUZZ); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1138 g_free(username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1139 g_free(m); |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1140 g_free(im->fed_from); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1141 g_free(im); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1142 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1143 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1144 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1145 m2 = yahoo_codes_to_html(m); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1146 g_free(m); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1147 |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1148 serv_got_im(gc, im->fed_from, m2, 0, im->time); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1149 g_free(m2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1150 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1151 /* Official clients don't share buddy images with federated buddies */ |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1152 if (im->fed == YAHOO_FEDERATION_NONE) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1153 if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1154 if (yahoo_friend_get_buddy_icon_need_request(f)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1155 yahoo_send_picture_request(gc, im->from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1156 yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1157 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1158 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1159 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1160 |
28423
318ac22eb05d
Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28384
diff
changeset
|
1161 g_free(im->fed_from); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1162 g_free(im); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1163 } |
28384
29e96fb6cff3
Yahoo prpl is crashing everytime a message from a yahoo buddy is received (have not checked federated ids).
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28364
diff
changeset
|
1164 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1165 g_slist_free(list); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1166 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1167 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1168 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1169 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1170 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1171 char *prim, *me = NULL, *msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1172 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1173 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1174 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1175 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1176 if (pair->key == 5) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1177 me = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1178 if (pair->key == 14) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1179 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1180 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1181 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1182 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1183 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1184 if (!msg || !g_utf8_validate(msg, -1, NULL)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1185 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1186 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1187 prim = g_strdup_printf(_("Yahoo! system message for %s:"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1188 me?me:purple_connection_get_display_name(gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1189 purple_notify_info(NULL, NULL, prim, msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1190 g_free(prim); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1191 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1192 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1193 struct yahoo_add_request { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1194 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1195 char *id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1196 char *who; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1197 YahooFederation fed; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1198 }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1199 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1200 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1201 yahoo_buddy_add_authorize_cb(gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1202 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1203 struct yahoo_add_request *add_req = data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1204 struct yahoo_packet *pkt; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
1205 YahooData *yd = purple_connection_get_protocol_data(add_req->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1206 const char *who = add_req->who; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1207 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1208 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1209 if (add_req->fed) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1210 who += 4; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1211 yahoo_packet_hash(pkt, "ssiii", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1212 1, add_req->id, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1213 5, who, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1214 241, add_req->fed, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1215 13, 1, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1216 334, 0); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1217 } |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1218 else { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1219 yahoo_packet_hash(pkt, "ssii", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1220 1, add_req->id, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1221 5, who, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1222 13, 1, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1223 334, 0); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1224 } |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1225 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1226 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1227 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1228 g_free(add_req->id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1229 g_free(add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1230 g_free(add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1231 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1232 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1233 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1234 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1235 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
1236 YahooData *yd = purple_connection_get_protocol_data(add_req->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1237 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1238 char *encoded_msg = NULL; |
27441
b00f138c850a
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27423
diff
changeset
|
1239 const char *who = add_req->who; |
b00f138c850a
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27423
diff
changeset
|
1240 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1241 if (msg && *msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1242 encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1243 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1244 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
1245 YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1246 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1247 if (add_req->fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1248 who += 4; /* Skip fed identifier (msn|ocs|ibm)/' */ |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1249 yahoo_packet_hash(pkt, "ssiiiis", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1250 1, add_req->id, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1251 5, who, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1252 241, add_req->fed, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1253 13, 2, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1254 334, 0, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1255 97, 1, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1256 14, encoded_msg ? encoded_msg : ""); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1257 } |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1258 else { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1259 yahoo_packet_hash(pkt, "ssiiis", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1260 1, add_req->id, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1261 5, who, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1262 13, 2, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1263 334, 0, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1264 97, 1, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1265 14, encoded_msg ? encoded_msg : ""); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1266 } |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1267 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1268 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1269 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1270 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1271 g_free(encoded_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1272 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1273 g_free(add_req->id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1274 g_free(add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1275 g_free(add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1276 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1277 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1278 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1279 yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1280 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1281 yahoo_buddy_add_deny_cb(add_req, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1282 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1283 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1284 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1285 yahoo_buddy_add_deny_reason_cb(gpointer data) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1286 struct yahoo_add_request *add_req = data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1287 purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1288 NULL, _("No reason given."), TRUE, FALSE, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1289 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1290 _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1291 purple_connection_get_account(add_req->gc), add_req->who, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1292 add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1293 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1294 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1295 static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1296 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1297 char *notify_msg; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
1298 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1299 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1300 if (who == NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1301 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1302 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1303 if (reason != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1304 char *msg2 = yahoo_string_decode(gc, reason, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1305 notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1306 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1307 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1308 notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list."), who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1309 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1310 purple_notify_info(gc, NULL, _("Add buddy rejected"), notify_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1311 g_free(notify_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1312 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1313 g_hash_table_remove(yd->friends, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1314 purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1315 /* TODO: Shouldn't we remove the buddy from our local list? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1316 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1317 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1318 static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1319 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1320 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1321 const char *msg = NULL; |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1322 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1323 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1324 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1325 /* Buddy authorized/declined our addition */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1326 if (pkt->status == 1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1327 char *temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1328 char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1329 int response = 0; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1330 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1331 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1332 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1333 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1334 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1335 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1336 case 4: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1337 temp = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1338 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1339 case 13: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1340 response = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1341 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1342 case 14: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1343 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1344 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1345 case 241: |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1346 fed = strtol(pair->value, NULL, 10); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1347 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1348 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1349 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1350 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1351 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1352 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1353 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1354 who = g_strconcat("msn/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1355 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1356 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1357 who = g_strconcat("ocs/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1358 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1359 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1360 who = g_strconcat("ibm/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1361 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1362 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1363 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1364 who = g_strdup(temp); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1365 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1366 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1367 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1368 if (response == 1) /* Authorized */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1369 purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1370 else if (response == 2) { /* Declined */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1371 purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1372 yahoo_buddy_denied_our_add(gc, who, msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1373 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1374 purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1375 g_free(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1376 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1377 /* Buddy requested authorization to add us. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1378 else if (pkt->status == 3) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1379 struct yahoo_add_request *add_req; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1380 const char *firstname = NULL, *lastname = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1381 char *temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1382 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1383 add_req = g_new0(struct yahoo_add_request, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1384 add_req->gc = gc; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1385 add_req->fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1386 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1387 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1388 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1389 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1390 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1391 case 4: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1392 temp = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1393 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1394 case 5: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1395 add_req->id = g_strdup(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1396 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1397 case 14: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1398 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1399 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1400 case 216: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1401 firstname = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1402 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1403 case 241: |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1404 add_req->fed = strtol(pair->value, NULL, 10); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1405 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1406 case 254: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1407 lastname = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1408 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1409 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1410 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1411 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1412 } |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1413 switch (add_req->fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1414 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1415 add_req->who = g_strconcat("msn/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1416 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1417 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1418 add_req->who = g_strconcat("ocs/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1419 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1420 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1421 add_req->who = g_strconcat("ibm/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1422 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1423 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1424 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1425 add_req->who = g_strdup(temp); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1426 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
1427 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1428 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1429 if (add_req->id && add_req->who) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1430 char *alias = NULL, *dec_msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1431 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1432 if (!purple_privacy_check(account, add_req->who)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1433 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1434 purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1435 add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1436 yahoo_buddy_add_deny_cb(add_req, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1437 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1438 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1439 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1440 if (msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1441 dec_msg = yahoo_string_decode(gc, msg, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1442 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1443 if (firstname && lastname) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1444 alias = g_strdup_printf("%s %s", firstname, lastname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1445 else if (firstname) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1446 alias = g_strdup(firstname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1447 else if (lastname) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1448 alias = g_strdup(lastname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1449 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1450 /* DONE! this is almost exactly the same as what MSN does, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1451 * this should probably be moved to the core. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1452 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1453 purple_account_request_authorization(account, add_req->who, add_req->id, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1454 alias, dec_msg, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1455 purple_find_buddy(account, add_req->who) != NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1456 yahoo_buddy_add_authorize_cb, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1457 yahoo_buddy_add_deny_reason_cb, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1458 add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1459 g_free(alias); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1460 g_free(dec_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1461 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1462 g_free(add_req->id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1463 g_free(add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1464 g_free(add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1465 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1466 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1467 purple_debug_error("yahoo", "Received authorization of unknown status (%d).\n", pkt->status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1468 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1469 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1470 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1471 /* I don't think this happens anymore in Version 15 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1472 static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1473 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1474 struct yahoo_add_request *add_req; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1475 char *msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1476 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1477 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1478 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1479 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1480 add_req = g_new0(struct yahoo_add_request, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1481 add_req->gc = gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1482 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1483 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1484 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1485 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1486 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1487 case 1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1488 add_req->id = g_strdup(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1489 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1490 case 3: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1491 add_req->who = g_strdup(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1492 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1493 case 15: /* time, for when they add us and we're offline */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1494 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1495 case 14: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1496 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1497 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1498 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1499 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1500 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1501 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1502 if (add_req->id && add_req->who) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1503 char *dec_msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1504 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1505 if (!purple_privacy_check(account, add_req->who)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1506 purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1507 add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1508 yahoo_buddy_add_deny_cb(add_req, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1509 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1510 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1511 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1512 if (msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1513 dec_msg = yahoo_string_decode(gc, msg, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1514 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1515 /* DONE! this is almost exactly the same as what MSN does, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1516 * this should probably be moved to the core. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1517 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1518 purple_account_request_authorization(account, add_req->who, add_req->id, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1519 NULL, dec_msg, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1520 purple_find_buddy(account,add_req->who) != NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1521 yahoo_buddy_add_authorize_cb, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1522 yahoo_buddy_add_deny_reason_cb, add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1523 g_free(dec_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1524 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1525 g_free(add_req->id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1526 g_free(add_req->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1527 g_free(add_req); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1528 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1529 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1530 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1531 /* I have no idea if this every gets called in version 15 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1532 static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1533 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1534 char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1535 char *msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1536 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1537 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1538 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1539 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1540 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1541 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1542 case 3: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1543 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1544 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1545 case 14: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1546 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1547 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1548 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1549 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1550 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1551 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1552 yahoo_buddy_denied_our_add(gc, who, msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1553 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1554 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1555 static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1556 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1557 switch (pkt->status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1558 case 1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1559 yahoo_process_status(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1560 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1561 case 3: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1562 yahoo_buddy_added_us(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1563 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1564 case 7: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1565 yahoo_buddy_denied_our_add_old(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1566 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1567 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1568 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1569 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1570 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1571 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1572 #define OUT_CHARSET "utf-8" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1573 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1574 static char *yahoo_decode(const char *text) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1575 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1576 char *converted = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1577 char *n, *new; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1578 const char *end, *p; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1579 int i, k; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1580 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1581 n = new = g_malloc(strlen (text) + 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1582 end = text + strlen(text); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1583 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1584 for (p = text; p < end; p++, n++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1585 if (*p == '\\') { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1586 if (p[1] >= '0' && p[1] <= '7') { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1587 p += 1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1588 for (i = 0, k = 0; k < 3; k += 1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1589 char c = p[k]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1590 if (c < '0' || c > '7') break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1591 i *= 8; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1592 i += c - '0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1593 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1594 *n = i; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1595 p += k - 1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1596 } else { /* bug 959248 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1597 /* If we see a \ not followed by an octal number, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1598 * it means that it is actually a \\ with one \ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1599 * already eaten by some unknown function. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1600 * This is arguably broken. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1601 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1602 * I think wing is wrong here, there is no function |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1603 * called that I see that could have done it. I guess |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1604 * it is just really sending single \'s. That's yahoo |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1605 * for you. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1606 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1607 *n = *p; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1608 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1609 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1610 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1611 *n = *p; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1612 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1613 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1614 *n = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1615 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1616 if (strstr(text, "\033$B")) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1617 converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1618 if (!converted) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1619 converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1620 g_free(new); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1621 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1622 return converted; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1623 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1624 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1625 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1626 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1627 PurpleAccount *account = purple_connection_get_account(gc); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
1628 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1629 const char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1630 const char *email = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1631 const char *subj = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1632 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1633 int count = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1634 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1635 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1636 if (!purple_account_get_check_mail(account)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1637 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1638 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1639 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1640 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1641 if (pair->key == 9) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1642 count = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1643 else if (pair->key == 43) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1644 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1645 else if (pair->key == 42) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1646 email = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1647 else if (pair->key == 18) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1648 subj = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1649 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1650 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1651 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1652 if (who && subj && email && *email) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1653 char *dec_who = yahoo_decode(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1654 char *dec_subj = yahoo_decode(subj); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1655 char *from = g_strdup_printf("%s (%s)", dec_who, email); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1656 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1657 purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1658 yahoo_mail_url, NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1659 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1660 g_free(dec_who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1661 g_free(dec_subj); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1662 g_free(from); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1663 } else if (count > 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1664 const char *tos[2] = { purple_account_get_username(account) }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1665 const char *urls[2] = { yahoo_mail_url }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1666 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1667 purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1668 NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1669 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1670 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1671 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1672 /* We use this structure once while we authenticate */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1673 struct yahoo_auth_data |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1674 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1675 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1676 char *seed; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1677 }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1678 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1679 /* This is the y64 alphabet... it's like base64, but has a . and a _ */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1680 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1681 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1682 /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1683 * in util.c, but it is different from the one yahoo uses */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1684 static void to_y64(char *out, const unsigned char *in, gsize inlen) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1685 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1686 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1687 for (; inlen >= 3; inlen -= 3) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1688 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1689 *out++ = base64digits[in[0] >> 2]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1690 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1691 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1692 *out++ = base64digits[in[2] & 0x3f]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1693 in += 3; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1694 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1695 if (inlen > 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1696 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1697 unsigned char fragment; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1698 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1699 *out++ = base64digits[in[0] >> 2]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1700 fragment = (in[0] << 4) & 0x30; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1701 if (inlen > 1) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1702 fragment |= in[1] >> 4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1703 *out++ = base64digits[fragment]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1704 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1705 *out++ = '-'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1706 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1707 *out = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1708 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1709 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1710 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1711 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
1712 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1713 PurpleAccount *account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1714 const char *name = purple_normalize(account, purple_account_get_username(account)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1715 PurpleCipher *md5_cipher; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1716 PurpleCipherContext *md5_ctx; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1717 guchar md5_digest[16]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1718 gchar base64_string[25]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1719 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1720 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1721 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1722 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1723 md5_cipher = purple_ciphers_find_cipher("md5"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1724 md5_ctx = purple_cipher_context_new(md5_cipher, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1725 purple_cipher_context_append(md5_ctx, (guchar *)crypt, strlen(crypt)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1726 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1727 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1728 to_y64(base64_string, md5_digest, 16); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1729 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1730 purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1731 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1732 |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1733 if(yd->cookie_b) { /* send B cookie if we have it */ |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1734 yahoo_packet_hash(pkt, "ssssssssss", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1735 1, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1736 0, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1737 277, yd->cookie_y, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1738 278, yd->cookie_t, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1739 307, base64_string, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1740 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1741 2, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1742 2, "1", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1743 59, yd->cookie_b, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1744 98, purple_account_get_string(account, "room_list_locale", yd->jp ? "jp" : "us"), |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1745 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1746 } else { /* don't try to send an empty B cookie - the server will be mad */ |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1747 yahoo_packet_hash(pkt, "sssssssss", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1748 1, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1749 0, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1750 277, yd->cookie_y, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1751 278, yd->cookie_t, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1752 307, base64_string, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1753 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1754 2, name, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1755 2, "1", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1756 98, purple_account_get_string(account, "room_list_locale", yd->jp ? "jp" : "us"), |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1757 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1758 } |
27596
4bd3f7d841e3
Clean up a case of unnecessarily duplicated code.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27595
diff
changeset
|
1759 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1760 if (yd->picture_checksum) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1761 yahoo_packet_hash_int(pkt, 192, yd->picture_checksum); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1762 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1763 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1764 purple_cipher_context_destroy(md5_ctx); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1765 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1766 |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1767 static gchar *yahoo_auth16_get_cookie_b(gchar *headers) |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1768 { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1769 gchar **splits = g_strsplit(headers, "\r\n", -1); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1770 gchar *tmp = NULL, *tmp2 = NULL, *sem = NULL; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1771 int elements = g_strv_length(splits), i; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1772 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1773 if(elements > 1) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1774 for(i = 0; i < elements; i++) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1775 if(g_ascii_strncasecmp(splits[i], "Set-Cookie: B=", 14) == 0) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1776 tmp = &splits[i][14]; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1777 sem = strchr(tmp, ';'); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1778 |
29698
ccaaee2a8e59
Fix a typo and a memleak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29697
diff
changeset
|
1779 if (sem != NULL) { |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1780 tmp2 = g_strndup(tmp, sem - tmp); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1781 purple_debug_info("yahoo", "Got needed part of B cookie: %s\n", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1782 tmp2 ? tmp2 : "(null)"); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1783 break; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1784 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1785 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1786 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1787 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1788 |
29698
ccaaee2a8e59
Fix a typo and a memleak.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29697
diff
changeset
|
1789 g_strfreev(splits); |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1790 return tmp2; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1791 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1792 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1793 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1794 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1795 struct yahoo_auth_data *auth_data = user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1796 PurpleConnection *gc = auth_data->gc; |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1797 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1798 gboolean try_login_on_error = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1799 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1800 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1801 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1802 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1803 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1804 if (error_message != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1805 purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
1806 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1807 g_free(auth_data->seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1808 g_free(auth_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1809 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1810 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1811 else if (len > 0 && ret_data && *ret_data) { |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1812 gchar **splits = g_strsplit(ret_data, "\r\n\r\n", -1), **split_data = NULL; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1813 int totalelements = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1814 int response_no = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1815 char *crumb = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1816 char *crypt = NULL; |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
1817 |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1818 if(g_strv_length(splits) > 1) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1819 yd->cookie_b = yahoo_auth16_get_cookie_b(splits[0]); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1820 split_data = g_strsplit(splits[1], "\r\n", -1); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1821 totalelements = g_strv_length(split_data); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1822 } |
29082
39716f7d2c93
Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28044
diff
changeset
|
1823 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1824 if (totalelements >= 4) { |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1825 int i; |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1826 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1827 for(i = 0; i < totalelements; i++) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1828 /* I'm not exactly a fan of the magic numbers, but it's obvious, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1829 * so no sense in wasting a bajillion vars or calls to strlen */ |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1830 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1831 if(g_ascii_isdigit(split_data[i][0])) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1832 /* if the current line and the next line both start with numbers, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1833 * the current line is the length of the body, so skip. If not, |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1834 * then the current line is the response code from the login process. */ |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1835 if(!g_ascii_isdigit(split_data[i + 1][0])) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1836 response_no = strtol(split_data[i], NULL, 10); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1837 purple_debug_info("yahoo", "Got auth16 stage 2 response code: %d\n", |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1838 response_no); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1839 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1840 } else if(strncmp(split_data[i], "crumb=", 6) == 0) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1841 crumb = g_strdup(&split_data[i][6]); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1842 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1843 if(purple_debug_is_unsafe()) |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1844 purple_debug_info("yahoo", "Got crumb: %s\n", crumb); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1845 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1846 } else if(strncmp(split_data[i], "Y=", 2) == 0) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1847 yd->cookie_y = g_strdup(&split_data[i][2]); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1848 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1849 if(purple_debug_is_unsafe()) |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1850 purple_debug_info("yahoo", "Got Y cookie: %s\n", yd->cookie_y); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1851 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1852 } else if(strncmp(split_data[i], "T=", 2) == 0) { |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1853 yd->cookie_t = g_strdup(&split_data[i][2]); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1854 |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1855 if(purple_debug_is_unsafe()) |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1856 purple_debug_info("yahoo", "Got T cookie: %s\n", yd->cookie_t); |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1857 } |
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1858 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1859 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1860 |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
1861 g_strfreev(splits); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1862 g_strfreev(split_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1863 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1864 if(response_no != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1865 /* Some error in the login process */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1866 PurpleConnectionError error; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1867 char *error_reason = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1868 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1869 switch(response_no) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1870 case -1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1871 /* Some error in the received stream */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1872 error_reason = g_strdup(_("Received invalid data")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1873 error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1874 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1875 case 100: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1876 /* Unknown error */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1877 error_reason = g_strdup(_("Unknown error")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1878 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1879 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1880 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1881 /* if we have everything we need, why not try to login irrespective of response */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1882 if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1883 try_login_on_error = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1884 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1885 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1886 error_reason = g_strdup(_("Unknown error")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1887 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1888 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1889 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1890 if(error_reason) { |
27515
f92d37b363c6
yahoo: Add the error code to the debug log.
Paul Aurich <paul@darkrain42.org>
parents:
27455
diff
changeset
|
1891 purple_debug_error("yahoo", "Authentication error: %s. " |
f92d37b363c6
yahoo: Add the error code to the debug log.
Paul Aurich <paul@darkrain42.org>
parents:
27455
diff
changeset
|
1892 "Code %d\n", error_reason, response_no); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
1893 purple_connection_error(gc, error, error_reason); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1894 g_free(error_reason); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1895 g_free(auth_data->seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1896 g_free(auth_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1897 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1898 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1899 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1900 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1901 crypt = g_strconcat(crumb, auth_data->seed, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1902 yahoo_auth16_stage3(gc, crypt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1903 g_free(crypt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1904 g_free(crumb); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1905 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1906 g_free(auth_data->seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1907 g_free(auth_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1908 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1909 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1910 static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1911 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1912 struct yahoo_auth_data *auth_data = user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1913 PurpleConnection *gc = auth_data->gc; |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1914 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1915 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1916 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1917 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
1918 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1919 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1920 if (error_message != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1921 purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
1922 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1923 g_free(auth_data->seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1924 g_free(auth_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1925 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1926 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1927 else if (len > 0 && ret_data && *ret_data) { |
29588
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1928 PurpleAccount *account = purple_connection_get_account(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1929 gchar **split_data = g_strsplit(ret_data, "\r\n", -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1930 int totalelements = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1931 int response_no = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1932 char *token = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1933 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1934 totalelements = g_strv_length(split_data); |
29082
39716f7d2c93
Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28044
diff
changeset
|
1935 |
29588
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1936 if(totalelements == 1) { /* Received an error code */ |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1937 response_no = strtol(split_data[0], NULL, 10); |
29588
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1938 } else if(totalelements == 2 || totalelements == 3 ) { /* received valid data */ |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1939 response_no = strtol(split_data[0], NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1940 token = g_strdup(split_data[1] + strlen("ymsgr=")); |
29588
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1941 } else { /* It looks like a transparent proxy has returned a document we don't want */ |
29587
ff8e865bf524
Attempt to handle transparent proxies that return documents instead of errors.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29356
diff
changeset
|
1942 response_no = -1; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1943 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1944 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1945 g_strfreev(split_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1946 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1947 if(response_no != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1948 /* Some error in the login process */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1949 PurpleConnectionError error; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1950 char *error_reason; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1951 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1952 switch(response_no) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1953 case -1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1954 /* Some error in the received stream */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1955 error_reason = g_strdup(_("Received invalid data")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1956 error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1957 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1958 case 1212: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1959 /* Password incorrect */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1960 /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */ |
29588
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1961 if (!purple_account_get_remember_password(account)) |
78f972c7de0e
Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29587
diff
changeset
|
1962 purple_account_set_password(account, NULL); |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
1963 error_reason = g_strdup(_("Incorrect password")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1964 error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1965 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1966 case 1213: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1967 /* security lock from too many failed login attempts */ |
29675
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1968 error_reason = g_strdup(_("Account locked: Too many failed login " |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1969 "attempts. Logging into the Yahoo! website may fix this.")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1970 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1971 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1972 case 1235: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1973 /* the username does not exist */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1974 error_reason = g_strdup(_("Username does not exist")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1975 error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1976 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1977 case 1214: |
29675
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1978 /* indicates a lock of some description */ |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1979 error_reason = g_strdup(_("Account locked: Unknown reason. Logging " |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1980 "into the Yahoo! website may fix this.")); |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1981 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1982 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1983 case 1236: |
29675
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1984 /* indicates a lock due to logging in too frequently */ |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1985 error_reason = g_strdup(_("Account locked: You have been logging in too " |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1986 "frequently. Wait a few minutes before trying to connect " |
6d18b6221c5e
Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29672
diff
changeset
|
1987 "again. Logging into the Yahoo! website may help.")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1988 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1989 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1990 case 100: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1991 /* username or password missing */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1992 error_reason = g_strdup(_("Username or password missing")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1993 error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1994 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1995 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1996 /* Unknown error! */ |
27490
bd8b78d9573c
Don't break string freeze.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27484
diff
changeset
|
1997 error_reason = g_strdup_printf(_("Unknown error (%d)"), response_no); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1998 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
1999 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2000 } |
27515
f92d37b363c6
yahoo: Add the error code to the debug log.
Paul Aurich <paul@darkrain42.org>
parents:
27455
diff
changeset
|
2001 purple_debug_error("yahoo", "Authentication error: %s. Code %d\n", |
f92d37b363c6
yahoo: Add the error code to the debug log.
Paul Aurich <paul@darkrain42.org>
parents:
27455
diff
changeset
|
2002 error_reason, response_no); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
2003 purple_connection_error(gc, error, error_reason); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2004 g_free(error_reason); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2005 g_free(auth_data->seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2006 g_free(auth_data); |
27799
da33da2e1a1e
Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <paul@darkrain42.org>
parents:
27784
diff
changeset
|
2007 g_free(token); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2008 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2009 else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2010 /* OK to login, correct information provided */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2011 PurpleUtilFetchUrlData *url_data = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2012 char *url = NULL; |
27319
430eb9e9042a
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27318
diff
changeset
|
2013 gboolean yahoojp = yahoo_is_japan(account); |
28044
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2014 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2015 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2016 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); |
31862
7df08e88d9bb
Rename purple_util_fetch_url_request_len_with_account to
Mark Doliner <mark@kingant.net>
parents:
31803
diff
changeset
|
2017 url_data = purple_util_fetch_url_request_len( |
28044
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2018 proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT, |
29688
9f482e11f066
Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29687
diff
changeset
|
2019 TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data); |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
2020 if (url_data) |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
2021 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2022 g_free(url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2023 g_free(token); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2024 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2025 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2026 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2027 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2028 static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2029 { |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
2030 YahooData *yd = purple_connection_get_protocol_data(gc); |
28044
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2031 PurpleAccount *account = purple_connection_get_account(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2032 PurpleUtilFetchUrlData *url_data = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2033 struct yahoo_auth_data *auth_data = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2034 char *url = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2035 char *encoded_username; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2036 char *encoded_password; |
28044
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2037 gboolean yahoojp = yahoo_is_japan(account); |
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2038 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2039 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2040 purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2041 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2042 if(!purple_ssl_is_supported()) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
2043 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2044 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2045 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2046 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2047 auth_data = g_new0(struct yahoo_auth_data, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2048 auth_data->gc = gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2049 auth_data->seed = g_strdup(seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2050 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2051 encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc)))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2052 encoded_password = g_strdup(purple_url_encode(purple_connection_get_password(gc))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2053 url = g_strdup_printf(yahoojp ? YAHOOJP_TOKEN_URL : YAHOO_TOKEN_URL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2054 encoded_username, encoded_password, purple_url_encode(seed)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2055 g_free(encoded_password); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2056 g_free(encoded_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2057 |
31862
7df08e88d9bb
Rename purple_util_fetch_url_request_len_with_account to
Mark Doliner <mark@kingant.net>
parents:
31803
diff
changeset
|
2058 url_data = purple_util_fetch_url_request_len( |
28044
74958cad186d
Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27999
diff
changeset
|
2059 proxy_ssl ? account : NULL, url, TRUE, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2060 YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2061 yahoo_auth16_stage1_cb, auth_data); |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
2062 if (url_data) |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
2063 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2064 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2065 g_free(url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2066 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2067 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2068 static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2069 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2070 char *seed = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2071 char *sn = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2072 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2073 int m = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2074 gchar *buf; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2075 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2076 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2077 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2078 if (pair->key == 94) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2079 seed = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2080 if (pair->key == 1) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2081 sn = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2082 if (pair->key == 13) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2083 m = atoi(pair->value); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2084 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2085 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2086 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2087 if (seed) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2088 switch (m) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2089 case 0: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2090 /* used to be for really old auth routine, dont support now */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2091 case 1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2092 case 2: /* Yahoo ver 16 authentication */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2093 yahoo_auth16_stage1(gc, seed); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2094 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2095 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2096 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2097 GHashTable *ui_info = purple_core_get_ui_info(); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2098 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2099 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2100 "authentication method. You will probably not be able " |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2101 "to successfully sign on to Yahoo. Check %s for updates."), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2102 ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2103 purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2104 buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2105 g_free(buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2106 yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2107 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2108 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2109 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2110 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2111 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2112 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2113 static void ignore_buddy(PurpleBuddy *buddy) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2114 PurpleGroup *group; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2115 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2116 gchar *name; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2117 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2118 if (!buddy) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2119 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2120 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2121 group = purple_buddy_get_group(buddy); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2122 name = g_strdup(purple_buddy_get_name(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2123 account = purple_buddy_get_account(buddy); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2124 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2125 purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2126 purple_account_remove_buddy(account, buddy, group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2127 purple_blist_remove_buddy(buddy); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2128 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2129 serv_add_deny(purple_account_get_connection(account), name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2130 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2131 g_free(name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2132 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2133 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2134 static void keep_buddy(PurpleBuddy *b) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2135 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2136 purple_privacy_deny_remove(purple_buddy_get_account(b), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2137 purple_buddy_get_name(b), 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2138 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2139 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2140 static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2141 PurpleBuddy *b; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2142 GSList *l; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2143 gchar *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2144 gchar *me = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2145 gchar buf[BUF_LONG]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2146 gboolean ignore = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2147 gint status = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2148 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2149 for (l = pkt->hash; l; l = l->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2150 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2151 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2152 case 0: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2153 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2154 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2155 case 1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2156 me = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2157 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2158 case 13: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2159 /* 1 == ignore, 2 == unignore */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2160 ignore = (strtol(pair->value, NULL, 10) == 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2161 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2162 case 66: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2163 status = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2164 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2165 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2166 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2167 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2168 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2169 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2170 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2171 * status |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2172 * 0 - ok |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2173 * 2 - already in ignore list, could not add |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2174 * 3 - not in ignore list, could not delete |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2175 * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2176 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2177 switch (status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2178 case 12: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2179 purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2180 who, (ignore ? "ignoring" : "unignoring")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2181 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2182 if (ignore) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2183 b = purple_find_buddy(gc->account, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2184 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2185 "user is on your buddy list. Clicking \"Yes\" " |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2186 "will remove and ignore the buddy."), who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2187 purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2188 gc->account, who, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2189 b, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2190 G_CALLBACK(ignore_buddy), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2191 G_CALLBACK(keep_buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2192 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2193 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2194 case 2: |
28256
3d5f1cde625a
These debug messages were missing newlines at the end.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28240
diff
changeset
|
2195 purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.\n", |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2196 who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2197 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2198 case 3: |
28256
3d5f1cde625a
These debug messages were missing newlines at the end.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28240
diff
changeset
|
2199 purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete\n", |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2200 who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2201 case 0: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2202 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2203 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2204 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2205 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2206 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2207 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2208 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2209 #ifdef TRY_WEBMESSENGER_LOGIN |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2210 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2211 #endif /* TRY_WEBMESSENGER_LOGIN */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2212 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2213 int err = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2214 char *msg; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2215 char *url = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2216 char *fullmsg; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2217 PurpleAccount *account = gc->account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2218 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2219 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2220 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2221 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2222 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2223 if (pair->key == 66) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2224 err = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2225 else if (pair->key == 20) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2226 url = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2227 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2228 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2229 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2230 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2231 switch (err) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2232 case 0: |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
2233 msg = g_strdup(_("Unknown error")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2234 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2235 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2236 case 3: |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
2237 msg = g_strdup(_("Username does not exist")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2238 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2239 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2240 case 13: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2241 #ifdef TRY_WEBMESSENGER_LOGIN |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2242 if (!yd->wm) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2243 PurpleUtilFetchUrlData *url_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2244 yd->wm = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2245 if (yd->fd >= 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2246 close(yd->fd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2247 if (gc->inpa) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2248 purple_input_remove(gc->inpa); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2249 url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2250 "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2251 if (url_data != NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2252 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2253 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2254 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2255 #endif /* TRY_WEBMESSENGER_LOGIN */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2256 if (!purple_account_get_remember_password(account)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2257 purple_account_set_password(account, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2258 |
27964
975e213733e8
Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27603
diff
changeset
|
2259 msg = g_strdup(_("Invalid username or password")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2260 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2261 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2262 case 14: |
27964
975e213733e8
Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27603
diff
changeset
|
2263 msg = g_strdup(_("Your account has been locked due to too many failed login attempts." |
27965
248e47560a4a
Whitespace after '.' in a string.
Paul Aurich <paul@darkrain42.org>
parents:
27964
diff
changeset
|
2264 " Please try logging into the Yahoo! website.")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2265 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2266 break; |
27782
931bb24c28ab
Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
27746
diff
changeset
|
2267 case 52: |
931bb24c28ab
Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
27746
diff
changeset
|
2268 /* See #9660. As much as we know, reconnecting shouldn't hurt */ |
27783
c499a1e8ceff
Unbreak the string freeze.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27782
diff
changeset
|
2269 purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n"); |
27976
0ab7b436a563
Better string for Yahoo error 52. Someone might want to try improving it still.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27975
diff
changeset
|
2270 msg = g_strdup_printf(_("Unknown error 52. Reconnecting should fix this.")); |
27784
b6a9e2079d50
Use PURPLE_CONNECTION_ERROR_NETWORK_ERROR as the connection error
Stu Tomlinson <stu@nosnilmot.com>
parents:
27783
diff
changeset
|
2271 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
27782
931bb24c28ab
Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
27746
diff
changeset
|
2272 break; |
27595
d53d082f1641
Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27548
diff
changeset
|
2273 case 1013: |
27964
975e213733e8
Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27603
diff
changeset
|
2274 msg = g_strdup(_("Error 1013: The username you have entered is invalid." |
28112
b8b90d4cf2f5
We generally don't hyphenate "email"
Mark Doliner <mark@kingant.net>
parents:
28088
diff
changeset
|
2275 " The most common cause of this error is entering your email" |
27964
975e213733e8
Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27603
diff
changeset
|
2276 " address instead of your Yahoo! ID.")); |
27595
d53d082f1641
Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27548
diff
changeset
|
2277 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; |
d53d082f1641
Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27548
diff
changeset
|
2278 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2279 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2280 msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2281 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2282 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2283 if (url) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2284 fullmsg = g_strdup_printf("%s\n%s", msg, url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2285 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2286 fullmsg = g_strdup(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2287 |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
2288 purple_connection_error(gc, reason, fullmsg); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2289 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2290 g_free(fullmsg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2291 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2292 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2293 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2294 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2295 int err = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2296 char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2297 char *temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2298 char *group = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2299 char *decoded_group; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2300 char *buf; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2301 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2302 GSList *l = pkt->hash; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2303 YahooData *yd = purple_connection_get_protocol_data(gc); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2304 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2305 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2306 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2307 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2308 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2309 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2310 case 66: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2311 err = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2312 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2313 case 7: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2314 temp = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2315 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2316 case 65: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2317 group = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2318 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2319 case 241: |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2320 fed = strtol(pair->value, NULL, 10); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2321 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2322 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2323 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2324 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2325 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2326 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2327 if (!temp) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2328 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2329 if (!group) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2330 group = ""; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2331 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2332 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2333 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2334 who = g_strconcat("msn/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2335 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2336 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2337 who = g_strconcat("ocs/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2338 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2339 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2340 who = g_strconcat("ibm/", temp, NULL); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2341 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2342 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2343 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2344 who = g_strdup(temp); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2345 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2346 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2347 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2348 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2349 f = yahoo_friend_find_or_new(gc, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2350 yahoo_update_status(gc, who, f); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2351 f->fed = fed; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2352 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2353 if( !g_hash_table_lookup(yd->peers, who) ) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2354 /* we are not connected as client, so set friend to not connected */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2355 if(fed) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2356 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2357 else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2358 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2359 f->p2p_packet_sent = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2360 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2361 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2362 else /* we are already connected. set friend to YAHOO_P2PSTATUS_WE_ARE_CLIENT */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2363 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2364 g_free(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2365 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2366 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2367 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2368 decoded_group = yahoo_string_decode(gc, group, FALSE); |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
2369 buf = g_strdup_printf(_("Unable to add buddy %s to group %s to the server list on account %s."), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2370 who, decoded_group, purple_connection_get_display_name(gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2371 if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
2372 purple_notify_error(gc, NULL, _("Unable to add buddy to server list"), buf); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2373 g_free(buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2374 g_free(decoded_group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2375 g_free(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2376 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2377 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2378 /* write pkt to the source */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2379 static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2380 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2381 size_t pkt_len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2382 guchar *raw_packet; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2383 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2384 /*build the raw packet and send it to the host*/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2385 pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2386 if(write(source, raw_packet, pkt_len) != pkt_len) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2387 purple_debug_warning("yahoo","p2p: couldn't write to the source\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2388 g_free(raw_packet); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2389 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2390 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2391 static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2392 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2393 struct yahoo_p2p_data *p2p_data = value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2394 PurpleConnection *gc = user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2395 struct yahoo_packet *pkt_to_send; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2396 PurpleAccount *account; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2397 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2398 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2399 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2400 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2401 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2402 yahoo_packet_hash(pkt_to_send, "ssisi", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2403 4, purple_normalize(account, purple_account_get_username(account)), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2404 5, p2p_data->host_username, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2405 241, 0, /* Protocol identifier */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2406 49, "PEERTOPEER", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2407 13, 7); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2408 yahoo_p2p_write_pkt(p2p_data->source, pkt_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2409 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2410 yahoo_packet_free(pkt_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2411 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2412 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2413 static gboolean yahoo_p2p_keepalive(gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2414 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2415 PurpleConnection *gc = data; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2416 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2417 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2418 g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2419 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2420 return TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2421 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2422 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2423 /* destroy p2p_data associated with a peer and close p2p connection. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2424 * g_hash_table_remove() calls this function to destroy p2p_data associated with the peer, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2425 * call g_hash_table_remove() instead of this fucntion if peer has an entry in the table */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2426 static void yahoo_p2p_disconnect_destroy_data(gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2427 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2428 struct yahoo_p2p_data *p2p_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2429 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2430 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2431 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2432 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2433 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2434 /* If friend, set him not connected */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2435 f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2436 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2437 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2438 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2439 if(p2p_data->source >= 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2440 close(p2p_data->source); |
27422
d46ab8c52cc4
Fix two errors when my p2p server connection times out.
Paul Aurich <paul@darkrain42.org>
parents:
27382
diff
changeset
|
2441 if (p2p_data->input_event > 0) |
d46ab8c52cc4
Fix two errors when my p2p server connection times out.
Paul Aurich <paul@darkrain42.org>
parents:
27382
diff
changeset
|
2442 purple_input_remove(p2p_data->input_event); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2443 g_free(p2p_data->host_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2444 g_free(p2p_data->host_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2445 g_free(p2p_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2446 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2447 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2448 /* exchange of initial p2pfilexfer packets, service type YAHOO_SERVICE_P2PFILEXFER */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2449 static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2450 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2451 struct yahoo_p2p_data *p2p_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2452 char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2453 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2454 struct yahoo_packet *pkt_to_send; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2455 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2456 int val_13_to_send = 0; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2457 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2458 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2459 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2460 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2461 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2462 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2463 yd = purple_connection_get_protocol_data(p2p_data->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2464 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2465 /* lets see whats in the packet */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2466 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2467 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2468 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2469 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2470 case 4: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2471 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2472 if(strncmp(who, p2p_data->host_username, strlen(p2p_data->host_username)) != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2473 /* from whom are we receiving the packets ?? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2474 purple_debug_warning("yahoo","p2p: received data from wrong user\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2475 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2476 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2477 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2478 case 13: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2479 p2p_data->val_13 = strtol(pair->value, NULL, 10); /* Value should be 5-7 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2480 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2481 /* case 5, 49 look laters, no use right now */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2482 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2483 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2484 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2485 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2486 account = purple_connection_get_account(p2p_data->gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2487 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2488 /* key_13: sort of a counter. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2489 * WHEN WE ARE CLIENT: yahoo server sends val_13 = 0, we send to peer val_13 = 1, receive back val_13 = 5, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2490 * we send val_13=6, receive val_13=7, we send val_13=7, HALT. Keep sending val_13 = 7 as keep alive. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2491 * WHEN WE ARE SERVER: we send val_13 = 0 to yahoo server, peer sends us val_13 = 1, we send val_13 = 5, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2492 * receive val_13 = 6, send val_13 = 7, receive val_13 = 7. HALT. Keep sending val_13 = 7 as keep alive. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2493 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2494 switch(p2p_data->val_13) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2495 case 1 : val_13_to_send = 5; break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2496 case 5 : val_13_to_send = 6; break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2497 case 6 : val_13_to_send = 7; break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2498 case 7 : if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2499 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2500 val_13_to_send = 7; break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2501 default: purple_debug_warning("yahoo","p2p:Unknown value for key 13\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2502 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2503 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2504 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2505 /* Build the yahoo packet */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2506 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2507 yahoo_packet_hash(pkt_to_send, "ssisi", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2508 4, purple_normalize(account, purple_account_get_username(account)), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2509 5, p2p_data->host_username, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2510 241, 0, /* Protocol identifier */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2511 49, "PEERTOPEER", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2512 13, val_13_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2513 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2514 /* build the raw packet and send it to the host */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2515 yahoo_p2p_write_pkt(source, pkt_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2516 yahoo_packet_free(pkt_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2517 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2518 if( val_13_to_send == 7 ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2519 if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2520 g_hash_table_insert(yd->peers, g_strdup(p2p_data->host_username), p2p_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2521 /* If the peer is a friend, set him connected */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2522 f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2523 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2524 if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2525 p2p_data->session_id = f->session_id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2526 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_SERVER); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2527 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2528 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2529 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2530 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2531 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2532 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2533 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2534 /* callback function associated with receiving of data, not considering receipt of multiple YMSG packets in a single TCP packet */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2535 static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputCondition cond) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2536 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2537 guchar buf[1024]; /* is it safe to assume a fixed array length of 1024 ?? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2538 int len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2539 int pos = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2540 int pktlen; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2541 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2542 guchar *start = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2543 struct yahoo_p2p_data *p2p_data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2544 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2545 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2546 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2547 return ; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2548 yd = purple_connection_get_protocol_data(p2p_data->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2549 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2550 len = read(source, buf, sizeof(buf)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2551 if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2552 return ; /* No Worries*/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2553 else if (len <= 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2554 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2555 purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2556 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2557 if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2558 g_hash_table_remove(yd->peers,p2p_data->host_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2559 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2560 yahoo_p2p_disconnect_destroy_data(data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2561 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2562 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2563 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2564 if(len < YAHOO_PACKET_HDRLEN) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2565 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2566 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2567 if(strncmp((char *)buf, "YMSG", MIN(4, len)) != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2568 /* Not a YMSG packet */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2569 purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2570 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2571 start = memchr(buf + 1, 'Y', len - 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2572 if (start == NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2573 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2574 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2575 g_memmove(buf, start, len - (start - buf)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2576 len -= start - buf; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2577 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2578 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2579 pos += 4; /* YMSG */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2580 pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2581 pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2582 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2583 pktlen = yahoo_get16(buf + pos); pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2584 purple_debug_misc("yahoo", "p2p: %d bytes to read\n", len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2585 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2586 pkt = yahoo_packet_new(0, 0, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2587 pkt->service = yahoo_get16(buf + pos); pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2588 pkt->status = yahoo_get32(buf + pos); pos += 4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2589 pkt->id = yahoo_get32(buf + pos); pos += 4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2590 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2591 purple_debug_misc("yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2592 yahoo_packet_read(pkt, buf + pos, pktlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2593 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2594 /* packet processing */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2595 switch(pkt->service) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2596 case YAHOO_SERVICE_P2PFILEXFER: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2597 yahoo_p2p_process_p2pfilexfer(data, source, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2598 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2599 case YAHOO_SERVICE_MESSAGE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2600 yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2601 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2602 case YAHOO_SERVICE_NOTIFY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2603 yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2604 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2605 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2606 purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2607 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2608 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2609 yahoo_packet_free(pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2610 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2611 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2612 static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2613 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2614 int acceptfd; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2615 struct yahoo_p2p_data *p2p_data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2616 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2617 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2618 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2619 return ; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2620 yd = purple_connection_get_protocol_data(p2p_data->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2621 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2622 acceptfd = accept(source, NULL, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2623 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2624 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2625 else if(acceptfd == -1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2626 purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2627 yahoo_p2p_disconnect_destroy_data(data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2628 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2629 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2630 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2631 /* remove timeout */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2632 if (yd->yahoo_p2p_server_timeout_handle) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2633 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2634 yd->yahoo_p2p_server_timeout_handle = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2635 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2636 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2637 /* remove watcher and close p2p server */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2638 if (yd->yahoo_p2p_server_watcher) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2639 purple_input_remove(yd->yahoo_p2p_server_watcher); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2640 yd->yahoo_p2p_server_watcher = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2641 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2642 if (yd->yahoo_local_p2p_server_fd >= 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2643 close(yd->yahoo_local_p2p_server_fd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2644 yd->yahoo_local_p2p_server_fd = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2645 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2646 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2647 /* Add an Input Read event to the file descriptor */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2648 p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2649 p2p_data->source = acceptfd; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2650 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2651 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2652 static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2653 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2654 struct yahoo_p2p_data *p2p_data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2655 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2656 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2657 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2658 return FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2659 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2660 yd = purple_connection_get_protocol_data(p2p_data->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2661 |
27422
d46ab8c52cc4
Fix two errors when my p2p server connection times out.
Paul Aurich <paul@darkrain42.org>
parents:
27382
diff
changeset
|
2662 purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2663 yahoo_p2p_disconnect_destroy_data(data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2664 purple_input_remove(yd->yahoo_p2p_server_watcher); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2665 yd->yahoo_p2p_server_watcher = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2666 close(yd->yahoo_local_p2p_server_fd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2667 yd->yahoo_local_p2p_server_fd = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2668 yd->yahoo_p2p_server_timeout_handle = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2669 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2670 return FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2671 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2672 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2673 static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2674 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2675 struct yahoo_p2p_data *p2p_data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2676 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2677 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2678 if(!(p2p_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2679 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2680 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2681 yd = purple_connection_get_protocol_data(p2p_data->gc); |
31082
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2682 yd->listen_data = NULL; |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2683 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2684 if(listenfd == -1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2685 purple_debug_warning("yahoo","p2p: error starting p2p server\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2686 yahoo_p2p_disconnect_destroy_data(data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2687 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2688 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2689 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2690 /* Add an Input Read event to the file descriptor */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2691 yd->yahoo_local_p2p_server_fd = listenfd; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2692 yd->yahoo_p2p_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_server_send_connected_cb,data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2693 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2694 /* add timeout */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2695 yd->yahoo_p2p_server_timeout_handle = purple_timeout_add_seconds(YAHOO_P2P_SERVER_TIMEOUT, yahoo_cancel_p2p_server_listen_cb, data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2696 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2697 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2698 /* send p2p pkt containing our encoded ip, asking peer to connect to us */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2699 void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2700 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2701 const char *public_ip; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2702 guint32 temp[4]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2703 guint32 ip; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2704 char temp_str[100]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2705 gchar *base64_ip = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2706 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2707 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2708 PurpleAccount *account; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2709 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2710 struct yahoo_p2p_data *p2p_data; |
30327
06d8de5dd53c
yahoo: Avoid misuse of purple_normalize
Paul Aurich <paul@darkrain42.org>
parents:
30214
diff
changeset
|
2711 const char *norm_username; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2712 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2713 f = yahoo_friend_find(gc, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2714 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2715 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2716 /* Do not send invitation if already listening for other connection */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2717 if(yd->yahoo_local_p2p_server_fd >= 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2718 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2719 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2720 /* One shouldn't try to connect to self */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2721 if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2722 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2723 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2724 /* send packet to only those friends who arent p2p connected and to whom we havent already sent. Do not send if this condition doesn't hold good */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2725 if( !( f && (yahoo_friend_get_p2p_status(f) == YAHOO_P2PSTATUS_NOT_CONNECTED) && (f->p2p_packet_sent == 0)) ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2726 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2727 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2728 /* Dont send p2p packet to buddies of other protocols */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
2729 if(f->fed) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2730 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2731 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2732 /* Finally, don't try to connect to buddies not online or on sms */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2733 if( (f->status == YAHOO_STATUS_OFFLINE) || f->sms ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2734 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2735 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2736 public_ip = purple_network_get_public_ip(); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2737 if( (sscanf(public_ip, "%u.%u.%u.%u", &temp[0], &temp[1], &temp[2], &temp[3])) !=4 ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2738 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2739 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2740 ip = (temp[3] << 24) | (temp[2] <<16) | (temp[1] << 8) | temp[0]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2741 sprintf(temp_str, "%d", ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2742 base64_ip = purple_base64_encode( (guchar *)temp_str, strlen(temp_str) ); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2743 |
30327
06d8de5dd53c
yahoo: Avoid misuse of purple_normalize
Paul Aurich <paul@darkrain42.org>
parents:
30214
diff
changeset
|
2744 norm_username = purple_normalize(account, purple_account_get_username(account)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2745 pkt = yahoo_packet_new(YAHOO_SERVICE_PEERTOPEER, YAHOO_STATUS_AVAILABLE, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2746 yahoo_packet_hash(pkt, "sssissis", |
30327
06d8de5dd53c
yahoo: Avoid misuse of purple_normalize
Paul Aurich <paul@darkrain42.org>
parents:
30214
diff
changeset
|
2747 1, norm_username, |
06d8de5dd53c
yahoo: Avoid misuse of purple_normalize
Paul Aurich <paul@darkrain42.org>
parents:
30214
diff
changeset
|
2748 4, norm_username, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2749 12, base64_ip, /* base64 encode ip */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2750 61, 0, /* To-do : figure out what is 61 for?? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2751 2, "", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2752 5, who, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2753 13, val_13, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2754 49, "PEERTOPEER"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2755 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2756 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2757 f->p2p_packet_sent = 1; /* set p2p_packet_sent to sent */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2758 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2759 p2p_data = g_new0(struct yahoo_p2p_data, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2760 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2761 p2p_data->gc = gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2762 p2p_data->host_ip = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2763 p2p_data->host_username = g_strdup(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2764 p2p_data->val_13 = val_13; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2765 p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2766 p2p_data->source = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2767 |
31082
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2768 /* FIXME: If the port is already used, purple_network_listener returns NULL and old listener won't be canceled |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2769 * in yahoo_close function. */ |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2770 if (yd->listen_data) |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2771 purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n"); |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2772 else { |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2773 yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2774 if (yd->listen_data == NULL) |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2775 purple_debug_warning("yahoo","p2p: Failed to created p2p server\n"); |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
2776 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2777 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2778 g_free(base64_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2779 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2780 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2781 /* function called when connection to p2p host is setup */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2782 static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2783 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2784 struct yahoo_p2p_data *p2p_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2785 struct yahoo_packet *pkt_to_send; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2786 PurpleAccount *account; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
2787 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2788 |
27823
90b471ba5282
Something will have gone horribly wrong if data is NULL here, so don't
Mark Doliner <mark@kingant.net>
parents:
27822
diff
changeset
|
2789 p2p_data = data; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
2790 yd = purple_connection_get_protocol_data(p2p_data->gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2791 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2792 if(error_message != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2793 purple_debug_warning("yahoo","p2p: %s\n",error_message); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2794 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2795 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2796 yahoo_p2p_disconnect_destroy_data(p2p_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2797 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2798 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2799 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2800 /* Add an Input Read event to the file descriptor */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2801 p2p_data->input_event = purple_input_add(source, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2802 p2p_data->source = source; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2803 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2804 account = purple_connection_get_account(p2p_data->gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2805 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2806 /* Build the yahoo packet */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2807 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2808 yahoo_packet_hash(pkt_to_send, "ssisi", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2809 4, purple_normalize(account, purple_account_get_username(account)), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2810 5, p2p_data->host_username, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2811 241, 0, /* Protocol identifier */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2812 49, "PEERTOPEER", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2813 13, 1); /* we receive key13= 0 or 2, we send key13=1 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2814 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2815 yahoo_p2p_write_pkt(source, pkt_to_send); /* build raw packet and send */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2816 yahoo_packet_free(pkt_to_send); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2817 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2818 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2819 static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2820 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2821 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2822 char *who = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2823 char *base64 = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2824 guchar *decoded; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2825 gsize len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2826 gint val_13 = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2827 gint val_11 = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2828 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2829 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2830 |
29589
c4fe6afad87a
yahoo: fix decoding of P2P session_id
vamposdecampos@gmail.com
parents:
29588
diff
changeset
|
2831 /* if status is not YAHOO_STATUS_BRB or YAHOO_STATUS_P2P, the packet bounced back, |
c4fe6afad87a
yahoo: fix decoding of P2P session_id
vamposdecampos@gmail.com
parents:
29588
diff
changeset
|
2832 * so it contains our own ip */ |
c4fe6afad87a
yahoo: fix decoding of P2P session_id
vamposdecampos@gmail.com
parents:
29588
diff
changeset
|
2833 if(pkt->status != YAHOO_STATUS_BRB && pkt->status != YAHOO_STATUS_P2P) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2834 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2835 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2836 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2837 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2838 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2839 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2840 case 5: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2841 /* our identity */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2842 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2843 case 4: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2844 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2845 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2846 case 1: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2847 /* who again, the master identity this time? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2848 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2849 case 12: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2850 base64 = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2851 /* so, this is an ip address. in base64. decoded it's in ascii. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2852 after strtol, it's in reversed byte order. Who thought this up?*/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2853 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2854 case 13: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2855 val_13 = strtol(pair->value, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2856 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2857 case 11: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2858 val_11 = strtol(pair->value, NULL, 10); /* session id of peer */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2859 if( (f = yahoo_friend_find(gc, who)) ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2860 f->session_id = val_11; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2861 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2862 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2863 TODO: figure these out |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2864 yahoo: Key: 61 Value: 0 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2865 yahoo: Key: 2 Value: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2866 yahoo: Key: 13 Value: 0 packet count ?? |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2867 yahoo: Key: 49 Value: PEERTOPEER |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2868 yahoo: Key: 140 Value: 1 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2869 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2870 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2871 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2872 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2873 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2874 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2875 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2876 if (base64) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2877 guint32 ip; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2878 YahooFriend *f; |
30616
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2879 char *host_ip, *tmp; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2880 struct yahoo_p2p_data *p2p_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2881 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2882 decoded = purple_base64_decode(base64, &len); |
30616
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2883 if (decoded == NULL) { |
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2884 purple_debug_info("yahoo","p2p: Unable to decode base64 IP (%s) \n", base64); |
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2885 return; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2886 } |
30616
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2887 tmp = purple_str_binary_to_ascii(decoded, len); |
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2888 purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); |
943fce8ef142
Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <daniel.atallah@gmail.com>
parents:
30430
diff
changeset
|
2889 g_free(tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2890 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2891 ip = strtol((gchar *)decoded, NULL, 10); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2892 g_free(decoded); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2893 host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2894 (ip >> 24) & 0xff); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2895 f = yahoo_friend_find(gc, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2896 if (f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2897 yahoo_friend_set_ip(f, host_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2898 purple_debug_info("yahoo", "IP : %s\n", host_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2899 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2900 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2901 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2902 if(val_11==0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2903 if(!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2904 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2905 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2906 val_11 = f->session_id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2907 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2908 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2909 p2p_data = g_new0(struct yahoo_p2p_data, 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2910 p2p_data->host_username = g_strdup(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2911 p2p_data->val_13 = val_13; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2912 p2p_data->session_id = val_11; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2913 p2p_data->host_ip = host_ip; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2914 p2p_data->gc = gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2915 p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2916 p2p_data->source = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2917 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2918 /* connect to host */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2919 if((purple_proxy_connect(gc, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2920 purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2921 g_free(p2p_data->host_ip); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2922 g_free(p2p_data->host_username); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2923 g_free(p2p_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2924 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2925 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2926 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2927 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2928 static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2929 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2930 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2931 char *who = NULL, *msg = NULL, *id = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2932 GSList *l = pkt->hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2933 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2934 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2935 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2936 while (l) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2937 struct yahoo_pair *pair = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2938 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2939 switch (pair->key) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2940 case 4: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2941 who = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2942 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2943 case 5: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2944 /* us */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2945 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2946 case 230: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2947 /* the audible, in foo.locale.bar.baz format |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2948 eg: base.tw.smiley.smiley43 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2949 id = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2950 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2951 case 231: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2952 /* the text of the audible */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2953 msg = pair->value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2954 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2955 case 232: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2956 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2957 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2958 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2959 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2960 l = l->next; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2961 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2962 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2963 if (!msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2964 msg = id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2965 if (!who || !msg) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2966 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2967 if (!g_utf8_validate(msg, -1, NULL)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2968 purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2969 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2970 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2971 if (!purple_privacy_check(account, who)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2972 purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2973 purple_account_get_username(account), who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2974 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2975 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2976 if (id) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2977 /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2978 char **audible_locale = g_strsplit(id, ".", 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2979 char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2980 g_strfreev(audible_locale); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2981 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2982 serv_got_im(gc, who, buf, 0, time(NULL)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2983 g_free(buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2984 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2985 serv_got_im(gc, who, msg, 0, time(NULL)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2986 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2987 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2988 static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2989 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2990 switch (pkt->service) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2991 case YAHOO_SERVICE_LOGON: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2992 case YAHOO_SERVICE_LOGOFF: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2993 case YAHOO_SERVICE_ISAWAY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2994 case YAHOO_SERVICE_ISBACK: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2995 case YAHOO_SERVICE_GAMELOGON: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2996 case YAHOO_SERVICE_GAMELOGOFF: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2997 case YAHOO_SERVICE_CHATLOGON: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2998 case YAHOO_SERVICE_CHATLOGOFF: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
2999 case YAHOO_SERVICE_Y6_STATUS_UPDATE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3000 case YAHOO_SERVICE_STATUS_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3001 yahoo_process_status(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3002 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3003 case YAHOO_SERVICE_NOTIFY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3004 yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3005 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3006 case YAHOO_SERVICE_MESSAGE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3007 case YAHOO_SERVICE_GAMEMSG: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3008 case YAHOO_SERVICE_CHATMSG: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3009 yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3010 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3011 case YAHOO_SERVICE_SYSMESSAGE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3012 yahoo_process_sysmessage(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3013 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3014 case YAHOO_SERVICE_NEWMAIL: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3015 yahoo_process_mail(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3016 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3017 case YAHOO_SERVICE_NEWCONTACT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3018 yahoo_process_contact(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3019 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3020 case YAHOO_SERVICE_AUTHRESP: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3021 yahoo_process_authresp(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3022 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3023 case YAHOO_SERVICE_LIST: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3024 yahoo_process_list(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3025 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3026 case YAHOO_SERVICE_LIST_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3027 yahoo_process_list_15(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3028 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3029 case YAHOO_SERVICE_AUTH: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3030 yahoo_process_auth(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3031 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3032 case YAHOO_SERVICE_AUTH_REQ_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3033 yahoo_buddy_auth_req_15(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3034 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3035 case YAHOO_SERVICE_ADDBUDDY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3036 yahoo_process_addbuddy(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3037 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3038 case YAHOO_SERVICE_IGNORECONTACT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3039 yahoo_process_ignore(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3040 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3041 case YAHOO_SERVICE_CONFINVITE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3042 case YAHOO_SERVICE_CONFADDINVITE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3043 yahoo_process_conference_invite(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3044 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3045 case YAHOO_SERVICE_CONFDECLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3046 yahoo_process_conference_decline(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3047 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3048 case YAHOO_SERVICE_CONFLOGON: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3049 yahoo_process_conference_logon(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3050 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3051 case YAHOO_SERVICE_CONFLOGOFF: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3052 yahoo_process_conference_logoff(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3053 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3054 case YAHOO_SERVICE_CONFMSG: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3055 yahoo_process_conference_message(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3056 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3057 case YAHOO_SERVICE_CHATONLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3058 yahoo_process_chat_online(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3059 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3060 case YAHOO_SERVICE_CHATLOGOUT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3061 yahoo_process_chat_logout(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3062 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3063 case YAHOO_SERVICE_CHATGOTO: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3064 yahoo_process_chat_goto(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3065 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3066 case YAHOO_SERVICE_CHATJOIN: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3067 yahoo_process_chat_join(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3068 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3069 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3070 case YAHOO_SERVICE_CHATEXIT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3071 yahoo_process_chat_exit(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3072 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3073 case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3074 case YAHOO_SERVICE_CHATADDINVITE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3075 yahoo_process_chat_addinvite(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3076 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3077 case YAHOO_SERVICE_COMMENT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3078 yahoo_process_chat_message(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3079 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3080 case YAHOO_SERVICE_PRESENCE_PERM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3081 case YAHOO_SERVICE_PRESENCE_SESSION: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3082 yahoo_process_presence(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3083 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3084 case YAHOO_SERVICE_P2PFILEXFER: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3085 /* This case had no break and continued; thus keeping it this way.*/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3086 yahoo_process_p2p(gc, pkt); /* P2PFILEXFER handled the same way as process_p2p */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3087 yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3088 case YAHOO_SERVICE_FILETRANSFER: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3089 yahoo_process_filetransfer(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3090 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3091 case YAHOO_SERVICE_PEERTOPEER: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3092 yahoo_process_p2p(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3093 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3094 case YAHOO_SERVICE_PICTURE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3095 yahoo_process_picture(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3096 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3097 case YAHOO_SERVICE_PICTURE_CHECKSUM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3098 yahoo_process_picture_checksum(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3099 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3100 case YAHOO_SERVICE_PICTURE_UPLOAD: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3101 yahoo_process_picture_upload(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3102 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3103 case YAHOO_SERVICE_PICTURE_UPDATE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3104 case YAHOO_SERVICE_AVATAR_UPDATE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3105 yahoo_process_avatar_update(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3106 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3107 case YAHOO_SERVICE_AUDIBLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3108 yahoo_process_audible(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3109 break; |
27538
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
3110 case YAHOO_SERVICE_CONTACT_DETAILS: |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
3111 yahoo_process_contact_details(gc, pkt); |
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
3112 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3113 case YAHOO_SERVICE_FILETRANS_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3114 yahoo_process_filetrans_15(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3115 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3116 case YAHOO_SERVICE_FILETRANS_INFO_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3117 yahoo_process_filetrans_info_15(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3118 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3119 case YAHOO_SERVICE_FILETRANS_ACC_15: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3120 yahoo_process_filetrans_acc_15(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3121 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3122 case YAHOO_SERVICE_SMS_MSG: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3123 yahoo_process_sms_message(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3124 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3125 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3126 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3127 purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3128 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3129 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3130 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3131 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3132 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3133 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3134 PurpleConnection *gc = data; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3135 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3136 char buf[1024]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3137 int len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3138 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3139 len = read(yd->fd, buf, sizeof(buf)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3140 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3141 if (len < 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3142 gchar *tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3143 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3144 if (errno == EAGAIN) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3145 /* No worries */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3146 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3147 |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3148 tmp = g_strdup_printf(_("Lost connection with server: %s"), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3149 g_strerror(errno)); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3150 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3151 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3152 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3153 } else if (len == 0) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3154 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3155 _("Server closed the connection")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3156 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3157 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3158 gc->last_received = time(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3159 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3160 memcpy(yd->rxqueue + yd->rxlen, buf, len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3161 yd->rxlen += len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3162 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3163 while (1) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3164 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3165 int pos = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3166 int pktlen; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3167 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3168 if (yd->rxlen < YAHOO_PACKET_HDRLEN) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3169 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3170 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3171 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3172 /* HEY! This isn't even a YMSG packet. What |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3173 * are you trying to pull? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3174 guchar *start; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3175 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3176 purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3177 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3178 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3179 if (start) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3180 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3181 yd->rxlen -= start - yd->rxqueue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3182 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3183 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3184 g_free(yd->rxqueue); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3185 yd->rxqueue = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3186 yd->rxlen = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3187 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3188 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3189 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3190 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3191 pos += 4; /* YMSG */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3192 pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3193 pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3194 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3195 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3196 purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3197 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3198 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3199 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3200 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3201 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3202 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3203 pkt = yahoo_packet_new(0, 0, 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3204 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3205 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3206 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3207 purple_debug_misc("yahoo", "Yahoo Service: 0x%02x Status: %d\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3208 pkt->service, pkt->status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3209 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3210 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3211 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3212 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3213 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3214 if (yd->rxlen) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3215 guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3216 g_free(yd->rxqueue); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3217 yd->rxqueue = tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3218 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3219 g_free(yd->rxqueue); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3220 yd->rxqueue = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3221 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3222 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3223 yahoo_packet_process(gc, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3224 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3225 yahoo_packet_free(pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3226 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3227 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3228 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3229 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3230 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3231 PurpleConnection *gc = data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
3232 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3233 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3234 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3235 if (source < 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3236 gchar *tmp; |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3237 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3238 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3239 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3240 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3241 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3242 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3243 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3244 yd->fd = source; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3245 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
3246 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3247 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3248 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3249 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3250 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3251 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3252 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3253 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3254 #ifdef TRY_WEBMESSENGER_LOGIN |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3255 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3256 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3257 PurpleConnection *gc = data; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
3258 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3259 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3260 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3261 if (source < 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3262 gchar *tmp; |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3263 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3264 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3265 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3266 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3267 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3268 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3269 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3270 yd->fd = source; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3271 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
3272 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3273 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3274 yahoo_packet_hash(pkt, "sss", 0, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3275 purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3276 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3277 6, yd->auth); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3278 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3279 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3280 g_free(yd->auth); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3281 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3282 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3283 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3284 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3285 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3286 PurpleConnection *gc = data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3287 PurpleAccount *account = purple_connection_get_account(gc); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3288 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3289 char bufread[2048], *i = bufread, *buf = bufread; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3290 int len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3291 GString *s; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3292 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3293 len = read(source, bufread, sizeof(bufread) - 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3294 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3295 if (len < 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3296 gchar *tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3297 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3298 if (errno == EAGAIN) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3299 /* No worries */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3300 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3301 |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3302 tmp = g_strdup_printf(_("Lost connection with server: %s"), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3303 g_strerror(errno)); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3304 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3305 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3306 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3307 } else if (len == 0) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3308 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3309 _("Server closed the connection")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3310 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3311 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3312 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3313 if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3314 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3315 memcpy(yd->rxqueue + yd->rxlen, buf, len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3316 yd->rxlen += len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3317 i = buf = (char *)yd->rxqueue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3318 len = yd->rxlen; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3319 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3320 buf[len] = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3321 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3322 if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3323 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3324 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3325 _("Received unexpected HTTP response from server")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3326 purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3327 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3328 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3329 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3330 s = g_string_sized_new(len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3331 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3332 while ((i = strstr(i, "Set-Cookie: "))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3333 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3334 i += strlen("Set-Cookie: "); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3335 for (;*i != ';' && *i != '\0'; i++) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3336 g_string_append_c(s, *i); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3337 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3338 g_string_append(s, "; "); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3339 /* Should these cookies be included too when trying for xfer? |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3340 * It seems to work without these |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3341 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3342 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3343 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3344 yd->auth = g_string_free(s, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3345 purple_input_remove(gc->inpa); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3346 close(source); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3347 g_free(yd->rxqueue); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3348 yd->rxqueue = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3349 yd->rxlen = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3350 /* Now we have our cookies to login with. I'll go get the milk. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3351 if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3352 purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3353 yahoo_got_web_connected, gc) == NULL) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3354 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3355 _("Unable to connect")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3356 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3357 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3358 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3359 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3360 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3361 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3362 PurpleConnection *gc; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
3363 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3364 int written, remaining; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3365 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3366 gc = data; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3367 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3368 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3369 remaining = strlen(yd->auth) - yd->auth_written; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3370 written = write(source, yd->auth + yd->auth_written, remaining); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3371 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3372 if (written < 0 && errno == EAGAIN) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3373 written = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3374 else if (written <= 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3375 gchar *tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3376 g_free(yd->auth); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3377 yd->auth = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3378 if (gc->inpa) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3379 purple_input_remove(gc->inpa); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3380 gc->inpa = 0; |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3381 tmp = g_strdup_printf(_("Lost connection with %s: %s"), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3382 "login.yahoo.com:80", g_strerror(errno)); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3383 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3384 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3385 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3386 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3387 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3388 if (written < remaining) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3389 yd->auth_written += written; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3390 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3391 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3392 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3393 g_free(yd->auth); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3394 yd->auth = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3395 yd->auth_written = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3396 purple_input_remove(gc->inpa); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3397 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3398 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3399 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3400 static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3401 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3402 PurpleConnection *gc = data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3403 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3404 if (source < 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3405 gchar *tmp; |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3406 tmp = g_strdup_printf(_("Unable to establish a connection with %s: %s"), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3407 "login.yahoo.com:80", error_message); |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3408 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3409 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3410 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3411 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3412 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3413 if (gc->inpa == 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3414 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3415 gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3416 yahoo_got_cookies_send_cb, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3417 yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3418 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3419 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3420 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3421 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3422 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3423 if (!strcmp(key, "passwd") || !strcmp(key, "login")) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3424 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3425 g_string_append_c(url, '&'); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3426 g_string_append(url, key); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3427 g_string_append_c(url, '='); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3428 if (!strcmp(key, ".save") || !strcmp(key, ".js")) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3429 g_string_append_c(url, '1'); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3430 else if (!strcmp(key, ".challenge")) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3431 g_string_append(url, val); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3432 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3433 g_string_append(url, purple_url_encode(val)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3434 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3435 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3436 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3437 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3438 GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3439 const char *c = buf; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3440 char *d; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3441 char name[64], value[64]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3442 int count; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3443 int input_len = strlen("<input "); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3444 int name_len = strlen("name=\""); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3445 int value_len = strlen("value=\""); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3446 while ((len > ((c - buf) + input_len)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3447 && (c = strstr(c, "<input "))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3448 if (!(c = g_strstr_len(c, len - (c - buf), "name=\""))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3449 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3450 c += name_len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3451 count = sizeof(name)-1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3452 for (d = name; (len > ((c - buf) + 1)) && *c!='"' |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3453 && count; c++, d++, count--) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3454 *d = *c; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3455 *d = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3456 count = sizeof(value)-1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3457 if (!(d = g_strstr_len(c, len - (c - buf), "value=\""))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3458 continue; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3459 d += value_len; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3460 if (strchr(c, '>') < d) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3461 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3462 for (c = d, d = value; (len > ((c - buf) + 1)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3463 && *c!='"' && count; c++, d++, count--) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3464 *d = *c; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3465 *d = '\0'; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3466 g_hash_table_insert(hash, g_strdup(name), g_strdup(value)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3467 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3468 return hash; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3469 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3470 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3471 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3472 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3473 const gchar *url_text, size_t len, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3474 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3475 PurpleConnection *gc = (PurpleConnection *)user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3476 PurpleAccount *account = purple_connection_get_account(gc); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3477 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3478 const char *sn = purple_account_get_username(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3479 const char *pass = purple_connection_get_password(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3480 GHashTable *hash = yahoo_login_page_hash(url_text, len); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3481 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3482 char md5[33], *hashp = md5, *chal; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3483 int i; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3484 PurpleCipher *cipher; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3485 PurpleCipherContext *context; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3486 guchar digest[16]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3487 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3488 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3489 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3490 if (error_message != NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3491 { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3492 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3493 error_message); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3494 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3495 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3496 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3497 url = g_string_append(url, sn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3498 url = g_string_append(url, "&passwd="); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3499 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3500 cipher = purple_ciphers_find_cipher("md5"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3501 context = purple_cipher_context_new(cipher, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3502 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3503 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3504 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3505 for (i = 0; i < 16; ++i) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3506 g_snprintf(hashp, 3, "%02x", digest[i]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3507 hashp += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3508 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3509 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3510 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3511 purple_cipher_context_reset(context, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3512 purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3513 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3514 hashp = md5; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3515 for (i = 0; i < 16; ++i) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3516 g_snprintf(hashp, 3, "%02x", digest[i]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3517 hashp += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3518 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3519 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3520 * I dunno why this is here and commented out.. but in case it's needed |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3521 * I updated it.. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3522 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3523 purple_cipher_context_reset(context, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3524 purple_cipher_context_append(context, md5, strlen(md5)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3525 purple_cipher_context_digest(context, sizeof(digest), digest, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3526 hashp = md5; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3527 for (i = 0; i < 16; ++i) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3528 g_snprintf(hashp, 3, "%02x", digest[i]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3529 hashp += 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3530 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3531 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3532 g_free(chal); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3533 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3534 url = g_string_append(url, md5); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3535 g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3536 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3537 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3538 "Host: login.yahoo.com\r\n\r\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3539 g_hash_table_destroy(hash); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3540 yd->auth = g_string_free(url, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3541 if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3542 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
27382
09772222714a
merge of '599603c54f97d6978ff312a4ff140857302b0033'
Mark Doliner <mark@kingant.net>
parents:
27319
diff
changeset
|
3543 _("Unable to connect")); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3544 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3545 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3546 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3547 purple_cipher_context_destroy(context); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3548 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3549 #endif /* TRY_WEBMESSENGER_LOGIN */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3550 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3551 static void yahoo_picture_check(PurpleAccount *account) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3552 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3553 PurpleConnection *gc = purple_account_get_connection(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3554 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3555 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3556 yahoo_set_buddy_icon(gc, img); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3557 purple_imgstore_unref(img); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3558 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3559 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3560 static int get_yahoo_status_from_purple_status(PurpleStatus *status) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3561 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3562 PurplePresence *presence; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3563 const char *status_id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3564 const char *msg; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3565 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3566 presence = purple_status_get_presence(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3567 status_id = purple_status_get_id(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3568 msg = purple_status_get_attr_string(status, "message"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3569 |
31664
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
3570 if ((msg != NULL) && (*msg != '\0')) { |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
3571 return YAHOO_STATUS_CUSTOM; |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
3572 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
3573 return YAHOO_STATUS_AVAILABLE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3574 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3575 return YAHOO_STATUS_BRB; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3576 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3577 return YAHOO_STATUS_BUSY; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3578 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3579 return YAHOO_STATUS_NOTATHOME; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3580 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3581 return YAHOO_STATUS_NOTATDESK; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3582 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3583 return YAHOO_STATUS_NOTINOFFICE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3584 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3585 return YAHOO_STATUS_ONPHONE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3586 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3587 return YAHOO_STATUS_ONVACATION; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3588 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3589 return YAHOO_STATUS_OUTTOLUNCH; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3590 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3591 return YAHOO_STATUS_STEPPEDOUT; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3592 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3593 return YAHOO_STATUS_INVISIBLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3594 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3595 return YAHOO_STATUS_CUSTOM; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3596 } else if (purple_presence_is_idle(presence)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3597 return YAHOO_STATUS_IDLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3598 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3599 purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3600 return YAHOO_STATUS_AVAILABLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3601 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3602 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3603 |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3604 static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data, |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3605 gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3606 { |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3607 YahooData *yd = user_data; |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3608 PurpleConnection *gc = yd->gc; |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3609 PurpleAccount *a = purple_connection_get_account(gc); |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3610 gchar **strings = NULL, *cs_server = NULL; |
30184
50380b60aa56
Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30181
diff
changeset
|
3611 int port = purple_account_get_int(a, "port", YAHOO_PAGER_PORT); |
50380b60aa56
Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30181
diff
changeset
|
3612 int stringslen = 0; |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3613 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
3614 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
3615 |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3616 if(error_message != NULL || len == 0) { |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3617 purple_debug_error("yahoo", "Unable to retrieve server info. %" |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3618 G_GSIZE_FORMAT " bytes retrieved with error message: %s\n", len, |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3619 error_message ? error_message : "(null)"); |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3620 |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3621 if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */ |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3622 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3623 _("Unable to connect: The server returned an empty response.")); |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3624 } else { |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3625 if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port, |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3626 yahoo_got_connected, gc) == NULL) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3627 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3628 _("Unable to connect")); |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3629 } |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3630 } |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3631 } else { |
29677 | 3632 strings = g_strsplit(url_text, "\r\n", -1); |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3633 |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3634 if((stringslen = g_strv_length(strings)) > 1) { |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3635 int i; |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3636 |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3637 for(i = 0; i < stringslen; i++) { |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3638 if(g_ascii_strncasecmp(strings[i], "COLO_CAPACITY=", 14) == 0) { |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3639 purple_debug_info("yahoo", "Got COLO Capacity: %s\n", &(strings[i][14])); |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3640 } else if(g_ascii_strncasecmp(strings[i], "CS_IP_ADDRESS=", 14) == 0) { |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3641 cs_server = g_strdup(&strings[i][14]); |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3642 purple_debug_info("yahoo", "Got CS IP address: %s\n", cs_server); |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3643 } |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3644 } |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3645 } |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3646 |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3647 if(cs_server) { /* got an address; get on with connecting */ |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3648 if(purple_proxy_connect(gc, a, cs_server, port, yahoo_got_connected, gc) == NULL) |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3649 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3650 _("Unable to connect")); |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3651 } else { |
29672
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3652 purple_debug_error("yahoo", "No CS address retrieved! Server " |
51f997e2347f
Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29666
diff
changeset
|
3653 "response:\n%s\n", url_text ? url_text : "(null)"); |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3654 |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3655 if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */ |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3656 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3657 _("Unable to connect: The server's response did not contain " |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3658 "the necessary information")); |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3659 } else |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3660 if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port, |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3661 yahoo_got_connected, gc) == NULL) { |
31872
a5b556ac1de5
Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <mark@kingant.net>
parents:
31862
diff
changeset
|
3662 purple_connection_error(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
30181
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3663 _("Unable to connect")); |
e9001aa49be8
Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30176
diff
changeset
|
3664 } |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3665 } |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3666 } |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3667 |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3668 g_strfreev(strings); |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3669 g_free(cs_server); |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3670 } |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3671 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
3672 void yahoo_login(PurpleAccount *account) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3673 PurpleConnection *gc = purple_account_get_connection(account); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3674 YahooData *yd = g_new0(YahooData, 1); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3675 PurpleStatus *status = purple_account_get_active_status(account); |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3676 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
30176
27aff21c5eea
Change the function of the "proxy_ssl" account option to cover regular HTTP
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29956
diff
changeset
|
3677 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE); |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
3678 PurpleUtilFetchUrlData *url_data; |
27548
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3679 |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3680 purple_connection_set_protocol_data(gc, yd); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3681 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3682 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3683 purple_connection_update_progress(gc, _("Connecting"), 1, 2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3684 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3685 purple_connection_set_display_name(gc, purple_account_get_username(account)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3686 |
27523
a9eb6dbbba1b
Set the back-reference to the connection from the proto-data.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27515
diff
changeset
|
3687 yd->gc = gc; |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3688 yd->jp = yahoo_is_japan(account); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3689 yd->yahoo_local_p2p_server_fd = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3690 yd->fd = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3691 yd->txhandler = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3692 /* TODO: Is there a good grow size for the buffer? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3693 yd->txbuf = purple_circ_buffer_new(0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3694 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3695 yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3696 yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); |
27548
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3697 yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3698 yahoo_p2p_disconnect_destroy_data); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3699 yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
27548
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3700 yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, |
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3701 yahoo_p2p_keepalive, gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3702 yd->confs = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3703 yd->conf_id = 2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3704 yd->last_keepalive = yd->last_ping = time(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3705 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3706 yd->current_status = get_yahoo_status_from_purple_status(status); |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3707 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3708 yahoo_picture_check(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3709 |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3710 /* Get the pager server. Actually start connecting in the callback since we |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3711 * must have the contents of the HTTP response to proceed. */ |
31862
7df08e88d9bb
Rename purple_util_fetch_url_request_len_with_account to
Mark Doliner <mark@kingant.net>
parents:
31803
diff
changeset
|
3712 url_data = purple_util_fetch_url_request_len( |
30176
27aff21c5eea
Change the function of the "proxy_ssl" account option to cover regular HTTP
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29956
diff
changeset
|
3713 proxy_ssl ? purple_connection_get_account(gc) : NULL, |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3714 yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL, |
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3715 use_whole_url ? TRUE : FALSE, |
30184
50380b60aa56
Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30181
diff
changeset
|
3716 YAHOO_CLIENT_USERAGENT, FALSE, NULL, FALSE, -1, |
29666
60af53dd42d5
Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29589
diff
changeset
|
3717 yahoo_got_pager_server, yd); |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
3718 if (url_data) |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
3719 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
27548
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3720 |
0d32c4c08deb
Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27539
diff
changeset
|
3721 return; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3722 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3723 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
3724 void yahoo_close(PurpleConnection *gc) { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3725 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3726 GSList *l; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3727 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3728 if (gc->inpa) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3729 purple_input_remove(gc->inpa); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3730 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3731 while (yd->url_datas) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3732 purple_util_fetch_url_cancel(yd->url_datas->data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3733 yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3734 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3735 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3736 for (l = yd->confs; l; l = l->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3737 PurpleConversation *conv = l->data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3738 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3739 yahoo_conf_leave(yd, purple_conversation_get_name(conv), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3740 purple_connection_get_display_name(gc), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3741 purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3742 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3743 g_slist_free(yd->confs); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3744 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3745 for (l = yd->cookies; l; l = l->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3746 g_free(l->data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3747 l->data=NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3748 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3749 g_slist_free(yd->cookies); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3750 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3751 yd->chat_online = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3752 if (yd->in_chat) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3753 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3754 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3755 purple_timeout_remove(yd->yahoo_p2p_timer); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3756 if(yd->yahoo_p2p_server_timeout_handle != 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3757 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3758 yd->yahoo_p2p_server_timeout_handle = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3759 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3760 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3761 /* close p2p server if it is waiting for a peer to connect */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3762 if (yd->yahoo_p2p_server_watcher) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3763 purple_input_remove(yd->yahoo_p2p_server_watcher); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3764 yd->yahoo_p2p_server_watcher = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3765 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3766 if (yd->yahoo_local_p2p_server_fd >= 0) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3767 close(yd->yahoo_local_p2p_server_fd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3768 yd->yahoo_local_p2p_server_fd = -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3769 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3770 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3771 g_hash_table_destroy(yd->sms_carrier); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3772 g_hash_table_destroy(yd->peers); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3773 g_hash_table_destroy(yd->friends); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3774 g_hash_table_destroy(yd->imvironments); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3775 g_hash_table_destroy(yd->xfer_peer_idstring_map); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3776 g_free(yd->chat_name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3777 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3778 g_free(yd->cookie_y); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3779 g_free(yd->cookie_t); |
29697
258454cfecee
Leaking the B cookie is bad.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
29688
diff
changeset
|
3780 g_free(yd->cookie_b); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3781 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3782 if (yd->txhandler) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3783 purple_input_remove(yd->txhandler); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3784 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3785 purple_circ_buffer_destroy(yd->txbuf); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3786 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3787 if (yd->fd >= 0) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3788 close(yd->fd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3789 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3790 g_free(yd->rxqueue); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3791 yd->rxlen = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3792 g_free(yd->picture_url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3793 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3794 if (yd->buddy_icon_connect_data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3795 purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3796 if (yd->picture_upload_todo) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3797 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3798 if (yd->ycht) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3799 ycht_connection_close(yd->ycht); |
31082
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
3800 if (yd->listen_data != NULL) |
86598f5d7ebd
Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
hanzz@soc.pidgin.im
parents:
30616
diff
changeset
|
3801 purple_network_listen_cancel(yd->listen_data); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3802 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3803 g_free(yd->pending_chat_room); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3804 g_free(yd->pending_chat_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3805 g_free(yd->pending_chat_topic); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3806 g_free(yd->pending_chat_goto); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3807 g_strfreev(yd->profiles); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3808 |
27538
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
3809 yahoo_personal_details_reset(&yd->ypd, TRUE); |
27455
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
3810 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3811 g_free(yd->current_list15_grp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3812 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3813 g_free(yd); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3814 purple_connection_set_protocol_data(gc, NULL); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3815 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3816 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
3817 const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3818 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3819 return "yahoo"; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3820 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3821 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
3822 const char *yahoo_list_emblem(PurpleBuddy *b) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3823 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3824 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3825 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3826 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3827 PurplePresence *presence; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3828 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3829 if (!b || !(account = purple_buddy_get_account(b)) || |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3830 !(gc = purple_account_get_connection(account)) || |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3831 !purple_connection_get_protocol_data(gc)) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3832 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3833 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3834 f = yahoo_friend_find(gc, purple_buddy_get_name(b)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3835 if (!f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3836 return "not-authorized"; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3837 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3838 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3839 presence = purple_buddy_get_presence(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3840 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3841 if (purple_presence_is_online(presence)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3842 if (yahoo_friend_get_game(f)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3843 return "game"; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
3844 |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
3845 if (f->fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
3846 return "external"; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3847 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3848 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3849 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3850 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3851 static const char *yahoo_get_status_string(enum yahoo_status a) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3852 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3853 switch (a) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3854 case YAHOO_STATUS_BRB: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3855 return _("Be Right Back"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3856 case YAHOO_STATUS_BUSY: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3857 return _("Busy"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3858 case YAHOO_STATUS_NOTATHOME: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3859 return _("Not at Home"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3860 case YAHOO_STATUS_NOTATDESK: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3861 return _("Not at Desk"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3862 case YAHOO_STATUS_NOTINOFFICE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3863 return _("Not in Office"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3864 case YAHOO_STATUS_ONPHONE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3865 return _("On the Phone"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3866 case YAHOO_STATUS_ONVACATION: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3867 return _("On Vacation"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3868 case YAHOO_STATUS_OUTTOLUNCH: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3869 return _("Out to Lunch"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3870 case YAHOO_STATUS_STEPPEDOUT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3871 return _("Stepped Out"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3872 case YAHOO_STATUS_INVISIBLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3873 return _("Invisible"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3874 case YAHOO_STATUS_IDLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3875 return _("Idle"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3876 case YAHOO_STATUS_OFFLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3877 return _("Offline"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3878 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3879 return _("Available"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3880 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3881 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3882 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3883 static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3884 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3885 PurpleBuddy *buddy; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3886 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3887 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3888 GHashTable *components; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
3889 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3890 int id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3891 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3892 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3893 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3894 buddy = (PurpleBuddy *) node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3895 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
3896 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3897 id = yd->conf_id; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3898 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3899 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3900 g_hash_table_replace(components, g_strdup("room"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3901 g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3902 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3903 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3904 yahoo_c_join(gc, components); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3905 g_hash_table_destroy(components); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3906 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3907 yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3908 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3909 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3910 static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3911 PurpleBuddy *buddy; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3912 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3913 int presence_val = GPOINTER_TO_INT(data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3914 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3915 buddy = (PurpleBuddy *) node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3916 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3917 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3918 yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3919 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3920 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3921 static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3922 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3923 PurpleBuddy *buddy; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3924 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3925 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3926 const char *game; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3927 char *game2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3928 char *t; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3929 char url[256]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3930 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3931 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3932 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3933 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3934 buddy = (PurpleBuddy *) node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3935 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3936 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3937 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3938 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3939 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3940 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3941 game = yahoo_friend_get_game(f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3942 if (!game) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3943 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3944 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3945 t = game2 = g_strdup(strstr(game, "ante?room=")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3946 while (*t && *t != '\t') |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3947 t++; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3948 *t = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3949 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3950 purple_notify_uri(gc, url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3951 g_free(game2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3952 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3953 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
3954 char *yahoo_status_text(PurpleBuddy *b) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3955 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3956 YahooFriend *f = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3957 const char *msg; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3958 char *msg2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3959 PurpleAccount *account; |
27423
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3960 PurpleConnection *gc; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3961 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3962 account = purple_buddy_get_account(b); |
27423
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3963 gc = purple_account_get_connection(account); |
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3964 if (!gc || !purple_connection_get_protocol_data(gc)) |
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3965 return NULL; |
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3966 |
d4cfd179203b
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <paul@darkrain42.org>
parents:
27422
diff
changeset
|
3967 f = yahoo_friend_find(gc, purple_buddy_get_name(b)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3968 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3969 return g_strdup(_("Not on server list")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3970 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3971 switch (f->status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3972 case YAHOO_STATUS_AVAILABLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3973 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3974 case YAHOO_STATUS_IDLE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3975 if (f->idle == -1) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3976 return g_strdup(yahoo_get_status_string(f->status)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3977 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3978 case YAHOO_STATUS_CUSTOM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3979 if (!(msg = yahoo_friend_get_status_message(f))) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3980 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3981 msg2 = g_markup_escape_text(msg, strlen(msg)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3982 purple_util_chrreplace(msg2, '\n', ' '); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3983 return msg2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3984 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3985 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3986 return g_strdup(yahoo_get_status_string(f->status)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3987 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3988 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3989 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3990 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3991 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3992 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3993 char *status = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3994 const char *presence = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3995 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3996 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3997 account = purple_buddy_get_account(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3998 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
3999 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4000 status = g_strdup_printf("\n%s", _("Not on server list")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4001 else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4002 switch (f->status) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4003 case YAHOO_STATUS_CUSTOM: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4004 if (!yahoo_friend_get_status_message(f)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4005 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4006 status = g_strdup(yahoo_friend_get_status_message(f)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4007 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4008 case YAHOO_STATUS_OFFLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4009 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4010 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4011 status = g_strdup(yahoo_get_status_string(f->status)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4012 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4013 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4014 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4015 switch (f->presence) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4016 case YAHOO_PRESENCE_ONLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4017 presence = _("Appear Online"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4018 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4019 case YAHOO_PRESENCE_PERM_OFFLINE: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4020 presence = _("Appear Permanently Offline"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4021 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4022 case YAHOO_PRESENCE_DEFAULT: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4023 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4024 default: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4025 purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4026 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4027 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4028 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4029 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4030 if (status != NULL) { |
31361
0123c69ec0e5
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <mark@kingant.net>
parents:
30214
diff
changeset
|
4031 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4032 g_free(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4033 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4034 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4035 if (presence != NULL) |
31361
0123c69ec0e5
Add a purple_notify_user_info_add_pair_plaintext function that accepts a
Mark Doliner <mark@kingant.net>
parents:
30214
diff
changeset
|
4036 purple_notify_user_info_add_pair_plaintext(user_info, _("Presence"), presence); |
27538
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
4037 |
27735
7da3bf6d3b2c
Don't crash when opening a tooltip for yahoo contacts who aren't on
Mike Ruprecht <maiku@soc.pidgin.im>
parents:
27694
diff
changeset
|
4038 if (f && full) { |
27538
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
4039 YahooPersonalDetails *ypd = &f->ypd; |
31900
ce6ef84fb8a0
Simplify. This is 6 lines instead of 15.
Mark Doliner <mark@kingant.net>
parents:
31899
diff
changeset
|
4040 if (ypd->phone.home && *ypd->phone.home) |
31901
dc3ea8f6381a
Use purple_notify_user_info_add_pair_plaintext in some places where we
Mark Doliner <mark@kingant.net>
parents:
31900
diff
changeset
|
4041 purple_notify_user_info_add_pair_plaintext(user_info, _("Home Phone Number"), ypd->phone.home); |
31900
ce6ef84fb8a0
Simplify. This is 6 lines instead of 15.
Mark Doliner <mark@kingant.net>
parents:
31899
diff
changeset
|
4042 if (ypd->phone.work && *ypd->phone.work) |
31901
dc3ea8f6381a
Use purple_notify_user_info_add_pair_plaintext in some places where we
Mark Doliner <mark@kingant.net>
parents:
31900
diff
changeset
|
4043 purple_notify_user_info_add_pair_plaintext(user_info, _("Work Phone Number"), ypd->phone.work); |
31900
ce6ef84fb8a0
Simplify. This is 6 lines instead of 15.
Mark Doliner <mark@kingant.net>
parents:
31899
diff
changeset
|
4044 if (ypd->phone.mobile && *ypd->phone.mobile) |
31901
dc3ea8f6381a
Use purple_notify_user_info_add_pair_plaintext in some places where we
Mark Doliner <mark@kingant.net>
parents:
31900
diff
changeset
|
4045 purple_notify_user_info_add_pair_plaintext(user_info, _("Mobile Phone Number"), ypd->phone.mobile); |
27538
fa827f6f990f
Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27527
diff
changeset
|
4046 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4047 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4048 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4049 static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4050 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4051 PurpleBuddy *buddy; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4052 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4053 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4054 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4055 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4056 buddy = (PurpleBuddy *) node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4057 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4058 |
32031
cd1d9e04c587
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32015
diff
changeset
|
4059 yahoo_add_buddy(gc, buddy, NULL, NULL); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4060 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4061 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4062 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4063 static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4064 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4065 PurpleBuddy *buddy; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4066 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4067 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4068 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4069 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4070 buddy = (PurpleBuddy *) node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4071 gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4072 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4073 yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4074 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4075 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4076 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4077 GList *m = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4078 PurpleMenuAction *act; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4079 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4080 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4081 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4082 if (f->presence != YAHOO_PRESENCE_ONLINE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4083 act = purple_menu_action_new(_("Appear Online"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4084 PURPLE_CALLBACK(yahoo_presence_settings), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4085 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4086 NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4087 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4088 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4089 act = purple_menu_action_new(_("Appear Offline"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4090 PURPLE_CALLBACK(yahoo_presence_settings), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4091 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4092 NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4093 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4094 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4095 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4096 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4097 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4098 act = purple_menu_action_new(_("Don't Appear Permanently Offline"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4099 PURPLE_CALLBACK(yahoo_presence_settings), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4100 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4101 NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4102 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4103 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4104 act = purple_menu_action_new(_("Appear Permanently Offline"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4105 PURPLE_CALLBACK(yahoo_presence_settings), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4106 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4107 NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4108 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4109 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4110 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4111 return m; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4112 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4113 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4114 static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4115 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4116 PurpleBuddy *b = (PurpleBuddy *)node; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4117 PurpleAccount *account = purple_buddy_get_account(b); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4118 PurpleConnection *gc = purple_account_get_connection(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4119 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4120 yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4121 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4122 |
27539
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4123 static void |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4124 yahoo_userinfo_blist_node(PurpleBlistNode *node, gpointer data) |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4125 { |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4126 PurpleBuddy *b = (PurpleBuddy *)node; |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4127 PurpleAccount *account = purple_buddy_get_account(b); |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4128 PurpleConnection *gc = purple_account_get_connection(account); |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4129 |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4130 yahoo_set_userinfo_for_buddy(gc, b); |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4131 } |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4132 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4133 static GList *yahoo_buddy_menu(PurpleBuddy *buddy) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4134 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4135 GList *m = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4136 PurpleMenuAction *act; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4137 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4138 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4139 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4140 static char buf2[1024]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4141 YahooFriend *f; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4142 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4143 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4144 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4145 if (!f && !yd->wm) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4146 act = purple_menu_action_new(_("Add Buddy"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4147 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4148 NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4149 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4150 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4151 return m; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4152 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4153 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4154 |
28465
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4155 if (f && f->status != YAHOO_STATUS_OFFLINE && f->fed == YAHOO_FEDERATION_NONE) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4156 if (!yd->wm) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4157 act = purple_menu_action_new(_("Join in Chat"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4158 PURPLE_CALLBACK(yahoo_chat_goto_menu), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4159 NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4160 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4161 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4162 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4163 act = purple_menu_action_new(_("Initiate Conference"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4164 PURPLE_CALLBACK(yahoo_initiate_conference), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4165 NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4166 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4167 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4168 if (yahoo_friend_get_game(f)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4169 const char *game = yahoo_friend_get_game(f); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4170 char *room; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4171 char *t; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4172 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4173 if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4174 while (*room && *room != '\t') /* skip to the tab */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4175 room++; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4176 t = room++; /* room as now at the name */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4177 while (*t != '\n') |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4178 t++; /* replace the \n with a space */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4179 *t = ' '; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4180 g_snprintf(buf2, sizeof buf2, "%s", room); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4181 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4182 act = purple_menu_action_new(buf2, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4183 PURPLE_CALLBACK(yahoo_game), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4184 NULL, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4185 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4186 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4187 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4188 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4189 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4190 if (f) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4191 act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4192 build_presence_submenu(f, gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4193 m = g_list_append(m, act); |
27539
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4194 |
28465
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4195 if (f->fed == YAHOO_FEDERATION_NONE) { |
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4196 act = purple_menu_action_new(_("Start Doodling"), |
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4197 PURPLE_CALLBACK(yahoo_doodle_blist_node), |
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4198 NULL, NULL); |
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4199 m = g_list_append(m, act); |
99b9c9ee7363
Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28463
diff
changeset
|
4200 } |
27539
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4201 |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4202 act = purple_menu_action_new(_("Set User Info..."), |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4203 PURPLE_CALLBACK(yahoo_userinfo_blist_node), |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4204 NULL, NULL); |
b909c4a7bfc8
Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27538
diff
changeset
|
4205 m = g_list_append(m, act); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4206 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4207 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4208 return m; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4209 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4210 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4211 GList *yahoo_blist_node_menu(PurpleBlistNode *node) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4212 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4213 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4214 return yahoo_buddy_menu((PurpleBuddy *) node); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4215 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4216 return NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4217 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4218 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4219 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4220 static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4221 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4222 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4223 const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4224 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4225 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4226 yahoo_packet_hash_str(pkt, 3, name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4227 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4228 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4229 purple_connection_set_display_name(gc, name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4230 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4231 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4232 static void |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4233 yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4234 const gchar *token, size_t len, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4235 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4236 PurpleConnection *gc = user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4237 gboolean set_cookie = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4238 gchar *url; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4239 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4240 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4241 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4242 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4243 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4244 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4245 if (error_message != NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4246 purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4247 else if (len > 0 && token && *token) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4248 /* Should we not be hardcoding the rd url? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4249 url = g_strdup_printf( |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4250 "http://login.yahoo.com/config/reset_cookies_token?" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4251 ".token=%s" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4252 "&.done=http://us.rd.yahoo.com/messenger/client/%%3fhttp://mail.yahoo.com/", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4253 token); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4254 set_cookie = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4255 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4256 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4257 if (!set_cookie) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4258 purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4259 url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4260 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4261 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4262 /* Open the mailbox with the parsed url data */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4263 purple_notify_uri(gc, url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4264 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4265 g_free(url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4266 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4267 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4268 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4269 static void yahoo_show_inbox(PurplePluginAction *action) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4270 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4271 /* Setup a cookie that can be used by the browser */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4272 /* XXX I have no idea how this will work with Yahoo! Japan. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4273 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4274 PurpleConnection *gc = action->context; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4275 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4276 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4277 PurpleUtilFetchUrlData *url_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4278 const char* base_url = "http://login.yahoo.com"; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4279 /* use whole URL if using HTTP Proxy */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4280 gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4281 gchar *request = g_strdup_printf( |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4282 "POST %s/config/cookie_token HTTP/1.0\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4283 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4284 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4285 "Host: login.yahoo.com\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4286 "Content-Length: 0\r\n\r\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4287 use_whole_url ? base_url : "", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4288 yd->cookie_t, yd->cookie_y); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4289 |
31862
7df08e88d9bb
Rename purple_util_fetch_url_request_len_with_account to
Mark Doliner <mark@kingant.net>
parents:
31803
diff
changeset
|
4290 url_data = purple_util_fetch_url_request_len( |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4291 purple_connection_get_account(gc), base_url, use_whole_url, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4292 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4293 yahoo_get_inbox_token_cb, gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4294 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4295 g_free(request); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4296 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4297 if (url_data != NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4298 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4299 else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4300 const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4301 purple_debug_error("yahoo", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4302 "Unable to request mail login token; forwarding to login screen."); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4303 purple_notify_uri(gc, yahoo_mail_url); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4304 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4305 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4306 |
27455
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4307 static void |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4308 yahoo_set_userinfo_fn(PurplePluginAction *action) |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4309 { |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4310 yahoo_set_userinfo(action->context); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4311 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4312 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4313 static void yahoo_show_act_id(PurplePluginAction *action) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4314 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4315 PurpleRequestFields *fields; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4316 PurpleRequestFieldGroup *group; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4317 PurpleRequestField *field; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4318 PurpleConnection *gc = (PurpleConnection *) action->context; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
4319 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4320 const char *name = purple_connection_get_display_name(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4321 int iter; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4322 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4323 fields = purple_request_fields_new(); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4324 group = purple_request_field_group_new(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4325 purple_request_fields_add_group(fields, group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4326 field = purple_request_field_choice_new("id", "Activate which ID?", 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4327 purple_request_field_group_add_field(group, field); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4328 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4329 for (iter = 0; yd->profiles[iter]; iter++) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4330 purple_request_field_choice_add(field, yd->profiles[iter]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4331 if (purple_strequal(yd->profiles[iter], name)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4332 purple_request_field_choice_set_default_value(field, iter); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4333 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4334 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4335 purple_request_fields(gc, NULL, _("Select the ID you want to activate"), NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4336 fields, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4337 _("OK"), G_CALLBACK(yahoo_act_id), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4338 _("Cancel"), NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4339 purple_connection_get_account(gc), NULL, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4340 gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4341 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4342 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4343 static void yahoo_show_chat_goto(PurplePluginAction *action) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4344 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4345 PurpleConnection *gc = (PurpleConnection *) action->context; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4346 purple_request_input(gc, NULL, _("Join whom in chat?"), NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4347 "", FALSE, FALSE, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4348 _("OK"), G_CALLBACK(yahoo_chat_goto), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4349 _("Cancel"), NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4350 purple_connection_get_account(gc), NULL, NULL, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4351 gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4352 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4353 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4354 GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4355 GList *m = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4356 PurplePluginAction *act; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4357 |
27455
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4358 act = purple_plugin_action_new(_("Set User Info..."), |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4359 yahoo_set_userinfo_fn); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4360 m = g_list_append(m, act); |
07d09a987b86
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
27441
diff
changeset
|
4361 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4362 act = purple_plugin_action_new(_("Activate ID..."), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4363 yahoo_show_act_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4364 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4365 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4366 act = purple_plugin_action_new(_("Join User in Chat..."), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4367 yahoo_show_chat_goto); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4368 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4369 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4370 m = g_list_append(m, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4371 act = purple_plugin_action_new(_("Open Inbox"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4372 yahoo_show_inbox); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4373 m = g_list_append(m, act); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4374 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4375 return m; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4376 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4377 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4378 struct yahoo_sms_carrier_cb_data { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4379 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4380 char *who; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4381 char *what; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4382 }; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4383 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4384 static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4385 const gchar *webdata, size_t len, const gchar *error_message) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4386 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4387 struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4388 PurpleConnection *gc = sms_cb_data->gc; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4389 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4390 char *status = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4391 char *carrier = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4392 PurpleAccount *account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4393 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4394 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
4395 yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
4396 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4397 if (error_message != NULL) { |
28276
154b4042d8cf
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28256
diff
changeset
|
4398 purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4399 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4400 g_free(sms_cb_data->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4401 g_free(sms_cb_data->what); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4402 g_free(sms_cb_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4403 return ; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4404 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4405 else if (len > 0 && webdata && *webdata) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4406 xmlnode *validate_data_root = xmlnode_from_str(webdata, -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4407 xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no"); |
28277
4bf9579328f0
Don't free what you don't own.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28276
diff
changeset
|
4408 const char *mobile_no = xmlnode_get_attrib(validate_data_child, "msisdn"); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4409 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4410 validate_data_root = xmlnode_copy(validate_data_child); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4411 validate_data_child = xmlnode_get_child(validate_data_root, "status"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4412 status = xmlnode_get_data(validate_data_child); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4413 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4414 validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4415 carrier = xmlnode_get_data(validate_data_child); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4416 |
29001
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4417 purple_debug_info("yahoo", "SMS validate data: %s\n", webdata); |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4418 |
31803 | 4419 if (status && g_str_equal(status, "Valid")) { |
29001
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4420 g_hash_table_insert(yd->sms_carrier, |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4421 g_strdup_printf("+%s", mobile_no), g_strdup(carrier)); |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4422 yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4423 sms_cb_data->what, PURPLE_MESSAGE_SEND); |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4424 } else { |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4425 g_hash_table_insert(yd->sms_carrier, |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4426 g_strdup_printf("+%s", mobile_no), g_strdup("Unknown")); |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4427 purple_conversation_write(conv, NULL, |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4428 _("Can't send SMS. Unknown mobile carrier."), |
fa35d7029a14
* Don't crash if status is NULL
Mark Doliner <mark@kingant.net>
parents:
28465
diff
changeset
|
4429 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4430 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4431 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4432 xmlnode_free(validate_data_child); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4433 xmlnode_free(validate_data_root); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4434 g_free(sms_cb_data->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4435 g_free(sms_cb_data->what); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4436 g_free(sms_cb_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4437 g_free(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4438 g_free(carrier); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4439 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4440 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4441 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4442 static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4443 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4444 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4445 PurpleUtilFetchUrlData *url_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4446 struct yahoo_sms_carrier_cb_data *sms_cb_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4447 char *validate_request_str = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4448 char *request = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4449 gboolean use_whole_url = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4450 xmlnode *validate_request_root = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4451 xmlnode *validate_request_child = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4452 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4453 if(!(sms_cb_data = data)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4454 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4455 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4456 validate_request_root = xmlnode_new("validate"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4457 xmlnode_set_attrib(validate_request_root, "intl", "us"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4458 xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4459 xmlnode_set_attrib(validate_request_root, "qos", "0"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4460 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4461 validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4462 xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4463 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4464 validate_request_str = xmlnode_to_str(validate_request_root, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4465 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4466 xmlnode_free(validate_request_child); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4467 xmlnode_free(validate_request_root); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4468 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4469 request = g_strdup_printf( |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4470 "POST /mobileno?intl=us&version=%s HTTP/1.1\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4471 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4472 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4473 "Host: validate.msg.yahoo.com\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4474 "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4475 "Cache-Control: no-cache\r\n\r\n%s", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4476 YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4477 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4478 /* use whole URL if using HTTP Proxy */ |
32015
ba74745ff179
Hide PurpleProxyInfo struct.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32002
diff
changeset
|
4479 if ((gc->account->proxy_info) && (purple_proxy_info_get_type(gc->account->proxy_info) == PURPLE_PROXY_HTTP)) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4480 use_whole_url = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4481 |
31862
7df08e88d9bb
Rename purple_util_fetch_url_request_len_with_account to
Mark Doliner <mark@kingant.net>
parents:
31803
diff
changeset
|
4482 url_data = purple_util_fetch_url_request_len( |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4483 purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4484 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4485 yahoo_get_sms_carrier_cb, data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4486 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4487 g_free(request); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4488 g_free(validate_request_str); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4489 |
29956
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
4490 if (url_data) |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
4491 yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
04c84a3f9553
yahoo: Fix a few race-condition crashes at login
Paul Aurich <paul@darkrain42.org>
parents:
29702
diff
changeset
|
4492 else { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4493 PurpleAccount *account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4494 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
28276
154b4042d8cf
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28256
diff
changeset
|
4495 purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4496 g_free(sms_cb_data->who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4497 g_free(sms_cb_data->what); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4498 g_free(sms_cb_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4499 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4500 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4501 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4502 int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4503 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4504 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4505 struct yahoo_packet *pkt = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4506 char *msg = yahoo_html_to_codes(what); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4507 char *msg2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4508 gboolean utf8 = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4509 PurpleWhiteboard *wb; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4510 int ret = 1; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4511 const char *fed_who; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4512 gsize lenb = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4513 glong lenc = 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4514 struct yahoo_p2p_data *p2p_data; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4515 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4516 msg2 = yahoo_string_encode(gc, msg, &utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4517 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4518 if(msg2) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4519 lenb = strlen(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4520 lenc = g_utf8_strlen(msg2, -1); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4521 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4522 if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4523 purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4524 " bytes, %ld characters. Max is %d bytes, %d chars." |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4525 " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4526 YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4527 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4528 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4529 return -E2BIG; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4530 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4531 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4532 |
28463
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
4533 fed = yahoo_get_federation_from_name(who); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4534 |
28298
60e4ef6801ff
I think this is the more correct way of determining invisibility.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28277
diff
changeset
|
4535 if (who[0] == '+') { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4536 /* we have an sms to be sent */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4537 gchar *carrier = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4538 const char *alias = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4539 PurpleAccount *account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4540 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4541 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4542 carrier = g_hash_table_lookup(yd->sms_carrier, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4543 if (!carrier) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4544 struct yahoo_sms_carrier_cb_data *sms_cb_data; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4545 sms_cb_data = g_malloc(sizeof(struct yahoo_sms_carrier_cb_data)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4546 sms_cb_data->gc = gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4547 sms_cb_data->who = g_strdup(who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4548 sms_cb_data->what = g_strdup(what); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4549 |
28276
154b4042d8cf
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28256
diff
changeset
|
4550 purple_conversation_write(conv, NULL, _("Getting mobile carrier to send the SMS."), PURPLE_MESSAGE_SYSTEM, time(NULL)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4551 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4552 yahoo_get_sms_carrier(gc, sms_cb_data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4553 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4554 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4555 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4556 return ret; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4557 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4558 else if( strcmp(carrier,"Unknown") == 0 ) { |
28276
154b4042d8cf
Mark some strings for translation.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28256
diff
changeset
|
4559 purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL)); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4560 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4561 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4562 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4563 return -1; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4564 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4565 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4566 alias = purple_account_get_alias(account); |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4567 pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4568 yahoo_packet_hash(pkt, "sssss", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4569 1, purple_connection_get_display_name(gc), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4570 69, alias, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4571 5, who + 1, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4572 68, carrier, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4573 14, msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4574 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4575 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4576 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4577 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4578 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4579 return ret; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4580 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4581 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4582 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4583 fed_who = who; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4584 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4585 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4586 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4587 case YAHOO_FEDERATION_IBM: |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
4588 case YAHOO_FEDERATION_PBX: |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4589 fed_who += 4; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4590 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4591 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4592 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4593 break; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4594 } |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4595 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, fed_who); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4596 if (fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4597 yahoo_packet_hash_int(pkt, 241, fed); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4598 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4599 if (utf8) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4600 yahoo_packet_hash_str(pkt, 97, "1"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4601 yahoo_packet_hash_str(pkt, 14, msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4602 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4603 /* |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4604 * IMVironment. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4605 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4606 * If this message is to a user who is also Doodling with the local user, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4607 * format the chat packet with the correct IMV information (thanks Yahoo!) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4608 * |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4609 * Otherwise attempt to use the same IMVironment as the remote user, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4610 * just so that we don't inadvertantly reset their IMVironment back |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4611 * to nothing. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4612 * |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4613 * If they have not set an IMVironment, then use the default. |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4614 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4615 wb = purple_whiteboard_get_session(gc->account, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4616 if (wb) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4617 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4618 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4619 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4620 const char *imv; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4621 imv = g_hash_table_lookup(yd->imvironments, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4622 if (imv != NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4623 yahoo_packet_hash_str(pkt, 63, imv); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4624 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4625 yahoo_packet_hash_str(pkt, 63, ";0"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4626 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4627 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4628 yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4629 yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4630 if (!yd->picture_url) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4631 yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4632 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4633 yahoo_packet_hash_str(pkt, 206, "2"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4634 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4635 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4636 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4637 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4638 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4639 yahoo_packet_hash_int(pkt, 11, p2p_data->session_id); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4640 yahoo_p2p_write_pkt(p2p_data->source, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4641 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4642 else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4643 yahoo_packet_send(pkt, yd); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4644 if(!fed) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4645 yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4646 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4647 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4648 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4649 ret = -E2BIG; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4650 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4651 yahoo_packet_free(pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4652 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4653 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4654 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4655 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4656 return ret; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4657 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4658 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4659 unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4660 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4661 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4662 struct yahoo_p2p_data *p2p_data; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4663 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4664 struct yahoo_packet *pkt = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4665 |
28463
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
4666 fed = yahoo_get_federation_from_name(who); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4667 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4668 /* Don't do anything if sms is being typed */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4669 if( strncmp(who, "+", 1) == 0 ) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4670 return 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4671 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4672 pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4673 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4674 /* check to see if p2p link exists, send through it */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4675 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4676 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4677 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4678 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4679 yahoo_p2p_write_pkt(p2p_data->source, pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4680 yahoo_packet_free(pkt); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4681 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4682 else { /* send through yahoo server */ |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4683 |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4684 const char *fed_who = who; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4685 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4686 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4687 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4688 case YAHOO_FEDERATION_IBM: |
29002
d1cecbc467c6
Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
kartikmohta@gmail.com
parents:
29001
diff
changeset
|
4689 case YAHOO_FEDERATION_PBX: |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4690 fed_who += 4; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4691 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4692 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4693 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4694 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4695 } |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
4696 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4697 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4698 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4699 5, fed_who, 1002, "1"); |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4700 if (fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4701 yahoo_packet_hash_int(pkt, 241, fed); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4702 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4703 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4704 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4705 return 0; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4706 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4707 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4708 static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4709 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4710 YahooFriend *f = value; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4711 if (f && f->presence == YAHOO_PRESENCE_ONLINE) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4712 f->presence = YAHOO_PRESENCE_DEFAULT; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4713 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4714 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4715 void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4716 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4717 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4718 PurplePresence *presence; |
27694
908be3822215
Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27672
diff
changeset
|
4719 YahooData *yd; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4720 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4721 int old_status; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4722 const char *msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4723 char *tmp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4724 char *conv_msg = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4725 gboolean utf8 = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4726 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4727 if (!purple_status_is_active(status)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4728 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4729 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4730 gc = purple_account_get_connection(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4731 presence = purple_status_get_presence(status); |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4732 yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4733 old_status = yd->current_status; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4734 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4735 yd->current_status = get_yahoo_status_from_purple_status(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4736 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4737 if (yd->current_status == YAHOO_STATUS_CUSTOM) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4738 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4739 msg = purple_status_get_attr_string(status, "message"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4740 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4741 if (purple_status_is_available(status)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4742 tmp = yahoo_string_encode(gc, msg, &utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4743 conv_msg = purple_markup_strip_html(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4744 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4745 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4746 if ((msg == NULL) || (*msg == '\0')) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4747 msg = _("Away"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4748 tmp = yahoo_string_encode(gc, msg, &utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4749 conv_msg = purple_markup_strip_html(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4750 g_free(tmp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4751 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4752 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4753 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4754 if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4755 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4756 yahoo_packet_hash_str(pkt, 13, "2"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4757 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4758 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4759 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4760 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4761 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4762 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4763 yahoo_packet_hash_int(pkt, 10, yd->current_status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4764 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4765 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4766 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4767 yahoo_packet_hash_str(pkt, 19, conv_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4768 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4769 yahoo_packet_hash_str(pkt, 19, ""); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4770 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4771 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4772 g_free(conv_msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4773 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4774 if (purple_presence_is_idle(presence)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4775 yahoo_packet_hash_str(pkt, 47, "2"); |
28239 | 4776 else { |
4777 if (!purple_status_is_available(status)) | |
4778 yahoo_packet_hash_str(pkt, 47, "1"); | |
4779 else | |
4780 yahoo_packet_hash_str(pkt, 47, "0"); | |
4781 } | |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4782 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4783 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4784 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4785 if (old_status == YAHOO_STATUS_INVISIBLE) { |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4786 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4787 yahoo_packet_hash_str(pkt, 13, "1"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4788 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4789 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4790 /* Any per-session presence settings are removed */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4791 g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4792 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4793 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4794 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4795 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4796 void yahoo_set_idle(PurpleConnection *gc, int idle) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4797 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4798 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4799 struct yahoo_packet *pkt = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4800 char *msg = NULL, *msg2 = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4801 PurpleStatus *status = NULL; |
28079 | 4802 gboolean invisible = FALSE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4803 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4804 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4805 yd->current_status = YAHOO_STATUS_IDLE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4806 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4807 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4808 yd->current_status = get_yahoo_status_from_purple_status(status); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4809 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4810 |
28298
60e4ef6801ff
I think this is the more correct way of determining invisibility.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28277
diff
changeset
|
4811 invisible = (yd->current_status == YAHOO_STATUS_INVISIBLE); |
28079 | 4812 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4813 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4814 |
28079 | 4815 if (!idle && invisible) |
4816 yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE); | |
4817 else | |
4818 yahoo_packet_hash_int(pkt, 10, yd->current_status); | |
4819 | |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4820 if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4821 const char *tmp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4822 if (status == NULL) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4823 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4824 tmp = purple_status_get_attr_string(status, "message"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4825 if (tmp != NULL) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4826 gboolean utf8 = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4827 msg = yahoo_string_encode(gc, tmp, &utf8); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4828 msg2 = purple_markup_strip_html(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4829 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4830 yahoo_packet_hash_str(pkt, 19, msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4831 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4832 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4833 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4834 yahoo_packet_hash_str(pkt, 19, _("Away")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4835 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4836 } else { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4837 yahoo_packet_hash_str(pkt, 19, ""); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4838 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4839 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4840 if (idle) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4841 yahoo_packet_hash_str(pkt, 47, "2"); |
31665
2d28bf68e63f
Fix coming out of idle while in an unavailable state for Yahoo
maiku@pidgin.im
parents:
31664
diff
changeset
|
4842 else if (yd->current_status == YAHOO_STATUS_CUSTOM && |
2d28bf68e63f
Fix coming out of idle while in an unavailable state for Yahoo
maiku@pidgin.im
parents:
31664
diff
changeset
|
4843 !purple_status_is_available(status)) |
2d28bf68e63f
Fix coming out of idle while in an unavailable state for Yahoo
maiku@pidgin.im
parents:
31664
diff
changeset
|
4844 /* We are still unavailable in this case. |
2d28bf68e63f
Fix coming out of idle while in an unavailable state for Yahoo
maiku@pidgin.im
parents:
31664
diff
changeset
|
4845 * Make sure Yahoo knows that */ |
2d28bf68e63f
Fix coming out of idle while in an unavailable state for Yahoo
maiku@pidgin.im
parents:
31664
diff
changeset
|
4846 yahoo_packet_hash_str(pkt, 47, "1"); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4847 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4848 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4849 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4850 g_free(msg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4851 g_free(msg2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4852 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4853 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4854 GList *yahoo_status_types(PurpleAccount *account) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4855 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4856 PurpleStatusType *type; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4857 GList *types = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4858 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4859 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4860 NULL, TRUE, TRUE, FALSE, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4861 "message", _("Message"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4862 purple_value_new(PURPLE_TYPE_STRING), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4863 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4864 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4865 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4866 NULL, TRUE, TRUE, FALSE, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4867 "message", _("Message"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4868 purple_value_new(PURPLE_TYPE_STRING), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4869 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4870 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4871 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4872 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4873 |
31664
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
4874 type = purple_status_type_new_with_attrs(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
4875 _("Busy"), TRUE, TRUE, FALSE, |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
4876 "message", _("Message"), |
ac3867fbd61f
Allow setting custom status messages for Yahoo when "Busy"
maiku@pidgin.im
parents:
31374
diff
changeset
|
4877 purple_value_new(PURPLE_TYPE_STRING), NULL); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4878 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4879 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4880 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4881 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4882 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4883 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4884 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4885 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4886 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4887 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4888 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4889 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4890 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4891 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4892 type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4893 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4894 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4895 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4896 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4897 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4898 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4899 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4900 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4901 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4902 type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4903 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4904 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4905 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4906 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4907 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4908 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4909 types = g_list_append(types, type); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4910 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4911 return types; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4912 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4913 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
4914 void yahoo_keepalive(PurpleConnection *gc) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4915 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4916 struct yahoo_packet *pkt; |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4917 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4918 time_t now = time(NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4919 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4920 /* We're only allowed to send a ping once an hour or the servers will boot us */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4921 if ((now - yd->last_ping) >= PING_TIMEOUT) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4922 yd->last_ping = now; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4923 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4924 /* The native client will only send PING or CHATPING */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4925 if (yd->chat_online) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4926 if (yd->wm) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4927 ycht_chat_send_keepalive(yd->ycht); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4928 } else { |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4929 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4930 yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4931 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4932 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4933 } else { |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4934 pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4935 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4936 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4937 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4938 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4939 if ((now - yd->last_keepalive) >= KEEPALIVE_TIMEOUT) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4940 yd->last_keepalive = now; |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4941 pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4942 yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4943 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4944 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4945 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4946 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4947 |
32031
cd1d9e04c587
Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32015
diff
changeset
|
4948 void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g, const char *message) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4949 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
4950 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4951 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4952 const char *group = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4953 char *group2; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4954 const char *bname; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4955 const char *fed_bname; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4956 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4957 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4958 if (!yd->logged_in) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4959 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4960 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4961 fed_bname = bname = purple_buddy_get_name(buddy); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4962 if (!purple_privacy_check(purple_connection_get_account(gc), bname)) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4963 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4964 |
28463
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
4965 fed = yahoo_get_federation_from_name(bname); |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
4966 if (fed != YAHOO_FEDERATION_NONE) |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4967 fed_bname += 4; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4968 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4969 g = purple_buddy_get_group(buddy); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4970 if (g) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4971 group = purple_group_get_name(g); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4972 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4973 group = "Buddies"; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4974 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4975 group2 = yahoo_string_encode(gc, group, NULL); |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
4976 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4977 if (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4978 yahoo_packet_hash(pkt, "sssssssisss", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4979 14, "", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4980 65, group2, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4981 97, "1", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4982 1, purple_connection_get_display_name(gc), |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4983 302, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4984 300, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4985 7, fed_bname, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4986 241, fed, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4987 334, "0", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4988 301, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4989 303, "319" |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4990 ); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4991 } |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4992 else { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
4993 yahoo_packet_hash(pkt, "ssssssssss", |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4994 14, "", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4995 65, group2, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4996 97, "1", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4997 1, purple_connection_get_display_name(gc), |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4998 302, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
4999 300, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5000 7, fed_bname, |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5001 334, "0", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5002 301, "319", |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5003 303, "319" |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5004 ); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5005 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5006 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5007 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5008 g_free(group2); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5009 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5010 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5011 void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5012 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
5013 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5014 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5015 GSList *buddies, *l; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5016 PurpleGroup *g; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5017 gboolean remove = TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5018 char *cg; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5019 const char *bname, *gname; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5020 YahooFriend *f = NULL; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5021 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5022 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5023 bname = purple_buddy_get_name(buddy); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5024 f = yahoo_friend_find(gc, bname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5025 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5026 return; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5027 fed = f->fed; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5028 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5029 gname = purple_group_get_name(group); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5030 buddies = purple_find_buddies(purple_connection_get_account(gc), bname); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5031 for (l = buddies; l; l = l->next) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5032 g = purple_buddy_get_group(l->data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5033 if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5034 remove = FALSE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5035 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5036 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5037 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5038 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5039 g_slist_free(buddies); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5040 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5041 if (remove) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5042 g_hash_table_remove(yd->friends, bname); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5043 f = NULL; /* f no longer valid - Just making it clear */ |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5044 } |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5045 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5046 cg = yahoo_string_encode(gc, gname, NULL); |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
5047 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5048 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5049 switch (fed) { |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5050 case YAHOO_FEDERATION_MSN: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5051 case YAHOO_FEDERATION_OCS: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5052 case YAHOO_FEDERATION_IBM: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5053 bname += 4; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5054 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5055 case YAHOO_FEDERATION_NONE: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5056 default: |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5057 break; |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5058 } |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5059 |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5060 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5061 7, bname, 65, cg); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5062 if (fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5063 yahoo_packet_hash_int(pkt, 241, fed); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5064 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5065 g_free(cg); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5066 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5067 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5068 void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
5069 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5070 struct yahoo_packet *pkt; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5071 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5072 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5073 if (!yd->logged_in) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5074 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5075 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5076 if (!who || who[0] == '\0') |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5077 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5078 |
28463
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
5079 fed = yahoo_get_federation_from_name(who); |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
5080 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
5081 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); |
28088
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5082 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5083 if(fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5084 yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "1"); |
28088
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5085 else |
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5086 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "1"); |
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5087 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5088 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5089 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5090 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5091 void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
5092 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5093 struct yahoo_packet *pkt; |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5094 YahooFederation fed = YAHOO_FEDERATION_NONE; |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5095 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5096 if (!yd->logged_in) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5097 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5098 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5099 if (!who || who[0] == '\0') |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5100 return; |
28463
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
5101 fed = yahoo_get_federation_from_name(who); |
7b88cc6c3f7a
Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
28456
diff
changeset
|
5102 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
5103 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id); |
28088
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5104 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5105 if(fed) |
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5106 yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "2"); |
28088
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5107 else |
e61b10db0044
This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents:
28085
diff
changeset
|
5108 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); |
31086
a8cc50c2279f
Remove trailing whitespace
Richard Laager <rlaager@wiktel.com>
parents:
31082
diff
changeset
|
5109 |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5110 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5111 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5112 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5113 void yahoo_set_permit_deny(PurpleConnection *gc) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5114 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5115 PurpleAccount *account; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5116 GSList *deny; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5117 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5118 account = purple_connection_get_account(gc); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5119 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5120 switch (account->perm_deny) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5121 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5122 case PURPLE_PRIVACY_ALLOW_ALL: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5123 for (deny = account->deny; deny; deny = deny->next) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5124 yahoo_rem_deny(gc, deny->data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5125 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5126 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5127 case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5128 case PURPLE_PRIVACY_ALLOW_USERS: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5129 case PURPLE_PRIVACY_DENY_USERS: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5130 case PURPLE_PRIVACY_DENY_ALL: |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5131 for (deny = account->deny; deny; deny = deny->next) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5132 yahoo_add_deny(gc, deny->data); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5133 break; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5134 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5135 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5136 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5137 void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5138 const char *old_group, const char *new_group) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5139 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
5140 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5141 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5142 char *gpn, *gpo; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5143 YahooFriend *f = yahoo_friend_find(gc, who); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5144 const char *temp = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5145 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5146 /* Step 0: If they aren't on the server list anyway, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5147 * don't bother letting the server know. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5148 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5149 if (!f) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5150 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5151 |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5152 if(f->fed) { |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5153 temp = who+4; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5154 } else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5155 temp = who; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5156 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5157 /* If old and new are the same, we would probably |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5158 * end up deleting the buddy, which would be bad. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5159 * This might happen because of the charset conversation. |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5160 */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5161 gpn = yahoo_string_encode(gc, new_group, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5162 gpo = yahoo_string_encode(gc, old_group, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5163 if (!strcmp(gpn, gpo)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5164 g_free(gpn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5165 g_free(gpo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5166 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5167 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5168 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
5169 pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, yd->session_id); |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5170 if(f->fed) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5171 yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc), |
28364
61856d0a2714
Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
kryojenik23-pidgin@steltek.com
parents:
28306
diff
changeset
|
5172 302, "240", 300, "240", 7, temp, 241, f->fed, 224, gpo, 264, gpn, 301, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5173 "240", 303, "240"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5174 else |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5175 yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5176 302, "240", 300, "240", 7, temp, 224, gpo, 264, gpn, 301, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5177 "240", 303, "240"); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5178 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5179 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5180 g_free(gpn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5181 g_free(gpo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5182 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5183 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5184 void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5185 PurpleGroup *group, GList *moved_buddies) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5186 { |
31998
fcf841ffd620
Convert yahoo prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data()
andrew.victor@mxit.com
parents:
31901
diff
changeset
|
5187 YahooData *yd = purple_connection_get_protocol_data(gc); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5188 struct yahoo_packet *pkt; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5189 char *gpn, *gpo; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5190 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5191 gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5192 gpo = yahoo_string_encode(gc, old_name, NULL); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5193 if (!strcmp(gpn, gpo)) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5194 g_free(gpn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5195 g_free(gpo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5196 return; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5197 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5198 |
27603
0ec880685f5f
Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27596
diff
changeset
|
5199 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, yd->session_id); |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5200 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5201 65, gpo, 67, gpn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5202 yahoo_packet_send_and_free(pkt, yd); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5203 g_free(gpn); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5204 g_free(gpo); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5205 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5206 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5207 /********************************* Commands **********************************/ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5208 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5209 PurpleCmdRet |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5210 yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5211 PurpleAccount *account = purple_conversation_get_account(c); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5212 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5213 if (*args && args[0]) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5214 return PURPLE_CMD_RET_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5215 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5216 purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5217 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5218 return PURPLE_CMD_RET_OK; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5219 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5220 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5221 PurpleCmdRet |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5222 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5223 char **args, char **error, void *data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5224 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5225 GHashTable *comp; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5226 PurpleConnection *gc; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5227 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5228 if (!args || !args[0]) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5229 return PURPLE_CMD_RET_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5230 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5231 gc = purple_conversation_get_gc(conv); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5232 purple_debug_info("yahoo", "Trying to join %s \n", args[0]); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5233 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5234 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5235 g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1)); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5236 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5237 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5238 yahoo_c_join(gc, comp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5239 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5240 g_hash_table_destroy(comp); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5241 return PURPLE_CMD_RET_OK; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5242 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5243 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5244 PurpleCmdRet |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5245 yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5246 char **args, char **error, void *data) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5247 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5248 PurpleAccount *account = purple_conversation_get_account(conv); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5249 if (*args && args[0]) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5250 return PURPLE_CMD_RET_FAILED; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5251 purple_roomlist_show_with_account(account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5252 return PURPLE_CMD_RET_OK; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5253 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5254 |
27318
31534ae3406a
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27316
diff
changeset
|
5255 gboolean yahoo_offline_message(const PurpleBuddy *buddy) |
27312
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5256 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5257 return TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5258 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5259 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5260 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5261 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5262 PurpleConversation *c; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5263 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5264 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5265 username, gc->account); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5266 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5267 g_return_val_if_fail(c != NULL, FALSE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5268 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5269 purple_debug_info("yahoo", "Sending <ding> on account %s to buddy %s.\n", |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5270 username, c->name); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5271 purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "<ding>", PURPLE_MESSAGE_INVISIBLE); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5272 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5273 return TRUE; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5274 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5275 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5276 GList *yahoo_attention_types(PurpleAccount *account) |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5277 { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5278 static GList *list = NULL; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5279 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5280 if (!list) { |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5281 /* Yahoo only supports one attention command: the 'buzz'. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5282 /* This is index number YAHOO_BUZZ. */ |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5283 list = g_list_append(list, purple_attention_type_new("Buzz", _("Buzz"), |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5284 _("%s has buzzed you!"), _("Buzzing %s..."))); |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5285 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5286 |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5287 return list; |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5288 } |
16ef6a9e7acd
Start of splitting yahoo into two separate prpls. Not sure if this even comes
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
diff
changeset
|
5289 |