Wed, 16 Jul 2008 21:55:08 +0000
propagate from branch 'im.pidgin.pidgin' (head ed811e1aea8072d306d472ee970bd5755e60c0ea)
to branch 'im.pidgin.soc.2008.vv' (head e4022bc472320aed5b828b40425e436d457d9990)
| 11477 | 1 | /* |
| 15884 | 2 | * purple - Bonjour Protocol Plugin |
| 11477 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 11477 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19842
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11477 | 21 | */ |
| 22 | #include <glib.h> | |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
23 | #ifndef _WIN32 |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
24 | #include <pwd.h> |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
25 | #else |
|
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
26 | #define UNICODE |
|
23072
6e7c147d622a
Bonjour build fixes for MSVC.
Daniel Atallah <datallah@pidgin.im>
parents:
22354
diff
changeset
|
27 | #include <winsock2.h> |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
28 | #include <windows.h> |
|
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
29 | #include <lm.h> |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
30 | #include "dns_sd_proxy.h" |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
31 | #endif |
| 11477 | 32 | |
| 33 | #include "internal.h" | |
|
13061
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
34 | |
| 11477 | 35 | #include "account.h" |
| 36 | #include "accountopt.h" | |
|
13061
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
37 | #include "debug.h" |
|
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
38 | #include "util.h" |
| 11477 | 39 | #include "version.h" |
| 40 | ||
| 41 | #include "bonjour.h" | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
16961
diff
changeset
|
42 | #include "mdns_common.h" |
| 11477 | 43 | #include "jabber.h" |
| 44 | #include "buddy.h" | |
|
21524
472e58992083
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
21503
diff
changeset
|
45 | #include "bonjour_ft.h" |
| 11477 | 46 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
47 | static char *default_firstname; |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
48 | static char *default_lastname; |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
49 | static char *default_hostname; |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
50 | |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
51 | static void |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
52 | bonjour_removeallfromlocal(PurpleConnection *conn, PurpleGroup *bonjour_group) |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
53 | { |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
54 | PurpleAccount *account = purple_connection_get_account(conn); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
55 | PurpleBlistNode *cnode, *cnodenext, *bnode, *bnodenext; |
| 15884 | 56 | PurpleBuddy *buddy; |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
57 | |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
58 | if (bonjour_group == NULL) |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
59 | return; |
|
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
60 | |
|
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
61 | /* Go through and remove all buddies that belong to this account */ |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
62 | for (cnode = ((PurpleBlistNode *) bonjour_group)->child; cnode; cnode = cnodenext) { |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
63 | cnodenext = cnode->next; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
64 | if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
65 | continue; |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
66 | for (bnode = cnode->child; bnode; bnode = bnodenext) { |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
67 | bnodenext = bnode->next; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
68 | if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
69 | continue; |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
70 | buddy = (PurpleBuddy *) bnode; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
71 | if (buddy->account != account) |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
72 | continue; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
73 | purple_prpl_got_user_status(account, buddy->name, "offline", NULL); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
74 | purple_account_remove_buddy(account, buddy, NULL); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
75 | purple_blist_remove_buddy(buddy); |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
76 | } |
|
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
77 | } |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
78 | |
|
11691
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
79 | } |
|
d46ace30ec7e
[gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents:
11539
diff
changeset
|
80 | |
|
12443
ad94864144f8
[gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12339
diff
changeset
|
81 | static void |
| 15884 | 82 | bonjour_login(PurpleAccount *account) |
| 11477 | 83 | { |
| 15884 | 84 | PurpleConnection *gc = purple_account_get_connection(account); |
|
17632
b27a15168d33
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <datallah@pidgin.im>
parents:
17608
diff
changeset
|
85 | BonjourData *bd; |
| 15884 | 86 | PurpleStatus *status; |
| 87 | PurplePresence *presence; | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
88 | |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
89 | #ifdef _WIN32 |
|
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
90 | if (!dns_sd_available()) { |
| 21279 | 91 | purple_connection_error_reason(gc, |
| 92 | PURPLE_CONNECTION_ERROR_OTHER_ERROR, | |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
93 | _("The Apple Bonjour For Windows toolkit wasn't found, see the FAQ at: " |
|
23233
d48808c72c25
Use shorter URL (http://d.pidgin.im/BonjourWindows) for "Bonjour not found"
Daniel Atallah <datallah@pidgin.im>
parents:
23140
diff
changeset
|
94 | "http://d.pidgin.im/BonjourWindows" |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
95 | " for more information.")); |
|
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
96 | return; |
|
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
97 | } |
|
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
98 | #endif |
|
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
99 | |
| 15884 | 100 | gc->flags |= PURPLE_CONNECTION_HTML; |
|
17632
b27a15168d33
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <datallah@pidgin.im>
parents:
17608
diff
changeset
|
101 | gc->proto_data = bd = g_new0(BonjourData, 1); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
102 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
103 | /* Start waiting for jabber connections (iChat style) */ |
|
21944
c41d17a1b8d9
This is the second part of the fix to support having multiple presence records in Bonjour (and also supporting multiple presences using the same IP). Incoming conversations are no longer immediately attached to a buddy - we use an algorithm to match a conversation to a buddy based on the IP and, if possible the "from" attribute of the stream or the first tag in the stream. Thanks to Sjoerd Simons from Telepahy Salut for noticing and suggesting the algorithm. Fixes #4187. It'd be good if a few people test this.
Daniel Atallah <datallah@pidgin.im>
parents:
21720
diff
changeset
|
104 | bd->jabber_data = g_new0(BonjourJabber, 1); |
| 13971 | 105 | bd->jabber_data->port = BONJOUR_DEFAULT_PORT_INT; |
| 11477 | 106 | bd->jabber_data->account = account; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
107 | |
| 11477 | 108 | if (bonjour_jabber_start(bd->jabber_data) == -1) { |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
109 | /* Send a message about the connection error */ |
| 21279 | 110 | purple_connection_error_reason (gc, |
| 111 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20435
bc4b48f6fbaa
Fix up Bonjour to use purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
112 | _("Unable to listen for incoming IM connections\n")); |
| 11477 | 113 | return; |
| 114 | } | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
115 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
116 | /* Connect to the mDNS daemon looking for buddies in the LAN */ |
| 11477 | 117 | bd->dns_sd_data = bonjour_dns_sd_new(); |
| 15884 | 118 | bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname)); |
| 119 | bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname)); | |
| 13971 | 120 | bd->dns_sd_data->port_p2pj = bd->jabber_data->port; |
|
17608
795ce8e3d44e
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
121 | /* Not engaged in AV conference */ |
|
795ce8e3d44e
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
122 | bd->dns_sd_data->vc = g_strdup("!"); |
|
11834
9c0104f0b8c3
[gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents:
11829
diff
changeset
|
123 | |
| 15884 | 124 | status = purple_account_get_active_status(account); |
| 125 | presence = purple_account_get_presence(account); | |
| 126 | if (purple_presence_is_available(presence)) | |
|
11834
9c0104f0b8c3
[gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents:
11829
diff
changeset
|
127 | bd->dns_sd_data->status = g_strdup("avail"); |
| 15884 | 128 | else if (purple_presence_is_idle(presence)) |
|
11834
9c0104f0b8c3
[gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents:
11829
diff
changeset
|
129 | bd->dns_sd_data->status = g_strdup("away"); |
|
9c0104f0b8c3
[gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents:
11829
diff
changeset
|
130 | else |
|
9c0104f0b8c3
[gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents:
11829
diff
changeset
|
131 | bd->dns_sd_data->status = g_strdup("dnd"); |
| 15884 | 132 | bd->dns_sd_data->msg = g_strdup(purple_status_get_attr_string(status, "message")); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
133 | |
| 11477 | 134 | bd->dns_sd_data->account = account; |
|
11927
f9ede13499d0
[gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents:
11841
diff
changeset
|
135 | if (!bonjour_dns_sd_start(bd->dns_sd_data)) |
|
f9ede13499d0
[gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents:
11841
diff
changeset
|
136 | { |
| 21279 | 137 | purple_connection_error_reason (gc, |
| 138 | PURPLE_CONNECTION_ERROR_NETWORK_ERROR, | |
|
20435
bc4b48f6fbaa
Fix up Bonjour to use purple_connection_error_reason.
Will Thompson <resiak@pidgin.im>
parents:
19859
diff
changeset
|
139 | _("Unable to establish connection with the local mDNS server. Is it running?")); |
|
11927
f9ede13499d0
[gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents:
11841
diff
changeset
|
140 | return; |
|
f9ede13499d0
[gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents:
11841
diff
changeset
|
141 | } |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
142 | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
143 | bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
144 | |
| 15884 | 145 | /* Show the buddy list by telling Purple we have already connected */ |
| 146 | purple_connection_set_state(gc, PURPLE_CONNECTED); | |
| 11477 | 147 | } |
| 148 | ||
|
12443
ad94864144f8
[gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12339
diff
changeset
|
149 | static void |
| 15884 | 150 | bonjour_close(PurpleConnection *connection) |
| 11477 | 151 | { |
| 15884 | 152 | PurpleGroup *bonjour_group; |
|
17632
b27a15168d33
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <datallah@pidgin.im>
parents:
17608
diff
changeset
|
153 | BonjourData *bd = connection->proto_data; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
154 | |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
155 | bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
156 | |
|
21614
6a22a040ee83
Now that the buddies are being removed from the list correctly, it needs to happen before the dns_sd stuff is cleaned up when we disconnect so that it doesn't crash the avahi implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
21612
diff
changeset
|
157 | /* Remove all the bonjour buddies */ |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
158 | bonjour_removeallfromlocal(connection, bonjour_group); |
|
21614
6a22a040ee83
Now that the buddies are being removed from the list correctly, it needs to happen before the dns_sd stuff is cleaned up when we disconnect so that it doesn't crash the avahi implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
21612
diff
changeset
|
159 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
160 | /* Stop looking for buddies in the LAN */ |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
161 | if (bd != NULL && bd->dns_sd_data != NULL) |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
162 | { |
| 11477 | 163 | bonjour_dns_sd_stop(bd->dns_sd_data); |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
164 | bonjour_dns_sd_free(bd->dns_sd_data); |
| 11477 | 165 | } |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
166 | |
|
20200
21898c919046
applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents:
19859
diff
changeset
|
167 | if (bd != NULL && bd->jabber_data != NULL) |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
168 | { |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
169 | /* Stop waiting for conversations */ |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
170 | bonjour_jabber_stop(bd->jabber_data); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
171 | g_free(bd->jabber_data); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
172 | } |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
173 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
174 | /* Delete the bonjour group */ |
| 13063 | 175 | if (bonjour_group != NULL) |
| 15884 | 176 | purple_blist_remove_group(bonjour_group); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
177 | |
|
21609
30ca7a909e62
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <datallah@pidgin.im>
parents:
21524
diff
changeset
|
178 | /* Cancel any file transfers */ |
|
30ca7a909e62
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <datallah@pidgin.im>
parents:
21524
diff
changeset
|
179 | while (bd != NULL && bd->xfer_lists) { |
|
30ca7a909e62
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <datallah@pidgin.im>
parents:
21524
diff
changeset
|
180 | purple_xfer_cancel_local(bd->xfer_lists->data); |
|
30ca7a909e62
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <datallah@pidgin.im>
parents:
21524
diff
changeset
|
181 | } |
|
30ca7a909e62
Fix a couple bugs in the Bonjour XEP-0065 implementation, mainly related to error handling, but also send a <streamhost-used /> result. Also fix a XEP-0096 bug where the SI profile wasn't being specified. These bring ft with gajim closer to working, but we aren't there yet.
Daniel Atallah <datallah@pidgin.im>
parents:
21524
diff
changeset
|
182 | |
|
20221
28e31ee832cd
applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents:
20200
diff
changeset
|
183 | g_free(bd); |
|
28e31ee832cd
applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents:
20200
diff
changeset
|
184 | connection->proto_data = NULL; |
| 11477 | 185 | } |
| 186 | ||
|
12443
ad94864144f8
[gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12339
diff
changeset
|
187 | static const char * |
| 15884 | 188 | bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) |
| 11477 | 189 | { |
| 190 | return BONJOUR_ICON_NAME; | |
| 191 | } | |
| 192 | ||
|
12443
ad94864144f8
[gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12339
diff
changeset
|
193 | static int |
| 15884 | 194 | bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) |
| 11477 | 195 | { |
| 196 | if(!to || !msg) | |
| 197 | return 0; | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
198 | |
|
11693
1a42a66ca0f8
[gaim-migrate @ 13979]
Mark Doliner <markdoliner@pidgin.im>
parents:
11691
diff
changeset
|
199 | return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg); |
| 11477 | 200 | } |
| 201 | ||
|
12443
ad94864144f8
[gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
12339
diff
changeset
|
202 | static void |
| 15884 | 203 | bonjour_set_status(PurpleAccount *account, PurpleStatus *status) |
| 11477 | 204 | { |
| 15884 | 205 | PurpleConnection *gc; |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
206 | BonjourData *bd; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
207 | gboolean disconnected; |
| 15884 | 208 | PurpleStatusType *type; |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
209 | int primitive; |
| 15884 | 210 | PurplePresence *presence; |
|
11841
85773b4974fe
[gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11839
diff
changeset
|
211 | const char *message, *bonjour_status; |
|
13061
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
212 | gchar *stripped; |
| 11477 | 213 | |
| 15884 | 214 | gc = purple_account_get_connection(account); |
|
11839
bb7002373bb6
[gaim-migrate @ 14130]
Mark Doliner <markdoliner@pidgin.im>
parents:
11837
diff
changeset
|
215 | bd = gc->proto_data; |
| 15884 | 216 | disconnected = purple_account_is_disconnected(account); |
| 217 | type = purple_status_get_type(status); | |
| 218 | primitive = purple_status_type_get_primitive(type); | |
| 219 | presence = purple_account_get_presence(account); | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
220 | |
| 15884 | 221 | message = purple_status_get_attr_string(status, "message"); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
222 | if (message == NULL) |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
223 | message = ""; |
| 15884 | 224 | stripped = purple_markup_strip_html(message); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
225 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
226 | /* |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
227 | * The three possible status for Bonjour are |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
228 | * -available ("avail") |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
229 | * -idle ("away") |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
230 | * -away ("dnd") |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
231 | * Each of them can have an optional message. |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
232 | */ |
| 15884 | 233 | if (purple_presence_is_available(presence)) |
|
11841
85773b4974fe
[gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11839
diff
changeset
|
234 | bonjour_status = "avail"; |
| 15884 | 235 | else if (purple_presence_is_idle(presence)) |
|
11841
85773b4974fe
[gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11839
diff
changeset
|
236 | bonjour_status = "away"; |
|
11835
da95d476b481
[gaim-migrate @ 14126]
Mark Doliner <markdoliner@pidgin.im>
parents:
11834
diff
changeset
|
237 | else |
|
11841
85773b4974fe
[gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11839
diff
changeset
|
238 | bonjour_status = "dnd"; |
| 11477 | 239 | |
|
13061
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
240 | bonjour_dns_sd_send_status(bd->dns_sd_data, bonjour_status, stripped); |
|
ab3ef8e402e4
[gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents:
12970
diff
changeset
|
241 | g_free(stripped); |
| 11477 | 242 | } |
| 243 | ||
|
21720
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
244 | /* |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
245 | * The add_buddy callback removes the buddy from the local list. |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
246 | * Bonjour manages buddies for you, and adding someone locally by |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
247 | * hand is stupid. Perhaps we should change libpurple not to allow adding |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
248 | * if there is no add_buddy callback. |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
249 | */ |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
250 | static void |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
251 | bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
252 | purple_debug_error("bonjour", "Buddy '%s' manually added; removing. " |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
253 | "Bonjour buddies must be discovered and not manually added.\n", |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
254 | purple_buddy_get_name(buddy)); |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
255 | |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
256 | /* I suppose we could alert the user here, but it seems unnecessary. */ |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
257 | |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
258 | /* If this causes problems, it can be moved to an idle callback */ |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
259 | purple_blist_remove_buddy(buddy); |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
260 | } |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
261 | |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
262 | |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
263 | static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
264 | if (buddy->proto_data) { |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
265 | bonjour_buddy_delete(buddy->proto_data); |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
266 | buddy->proto_data = NULL; |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
267 | } |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
268 | } |
|
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
269 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
270 | static GList * |
| 15884 | 271 | bonjour_status_types(PurpleAccount *account) |
| 11477 | 272 | { |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
273 | GList *status_types = NULL; |
| 15884 | 274 | PurpleStatusType *type; |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
275 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
276 | g_return_val_if_fail(account != NULL, NULL); |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
277 | |
| 15884 | 278 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
279 | BONJOUR_STATUS_ID_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
280 | NULL, TRUE, TRUE, FALSE, |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
281 | "message", _("Message"), |
| 15884 | 282 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
283 | status_types = g_list_append(status_types, type); |
| 11477 | 284 | |
| 15884 | 285 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
286 | BONJOUR_STATUS_ID_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
287 | NULL, TRUE, TRUE, FALSE, |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
288 | "message", _("Message"), |
| 15884 | 289 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
290 | status_types = g_list_append(status_types, type); |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
291 | |
| 15884 | 292 | type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12650
diff
changeset
|
293 | BONJOUR_STATUS_ID_OFFLINE, |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12650
diff
changeset
|
294 | NULL, TRUE, TRUE, FALSE); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12650
diff
changeset
|
295 | status_types = g_list_append(status_types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12650
diff
changeset
|
296 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
297 | return status_types; |
| 11477 | 298 | } |
| 299 | ||
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
300 | static void |
| 15884 | 301 | bonjour_convo_closed(PurpleConnection *connection, const char *who) |
| 11477 | 302 | { |
| 15884 | 303 | PurpleBuddy *buddy = purple_find_buddy(connection->account, who); |
|
17663
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17660
diff
changeset
|
304 | BonjourBuddy *bb; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
305 | |
|
21720
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
306 | if (buddy == NULL || buddy->proto_data == NULL) |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
307 | { |
|
11966
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
308 | /* |
|
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
309 | * This buddy is not in our buddy list, and therefore does not really |
|
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
310 | * exist, so we won't have any data about them. |
|
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
311 | */ |
|
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
312 | return; |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
313 | } |
|
11966
ad12fc2943ca
[gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents:
11927
diff
changeset
|
314 | |
|
17663
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17660
diff
changeset
|
315 | bb = buddy->proto_data; |
|
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17660
diff
changeset
|
316 | bonjour_jabber_close_conversation(bb->conversation); |
|
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17660
diff
changeset
|
317 | bb->conversation = NULL; |
| 11477 | 318 | } |
| 319 | ||
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
320 | static |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
321 | void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img) |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
322 | { |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
323 | BonjourData *bd = conn->proto_data; |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
324 | bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data); |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
325 | } |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
326 | |
|
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
327 | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
328 | static char * |
| 15884 | 329 | bonjour_status_text(PurpleBuddy *buddy) |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
330 | { |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
331 | const PurplePresence *presence; |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
332 | const PurpleStatus *status; |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
333 | const char *message; |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
334 | gchar *ret = NULL; |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
335 | |
| 15884 | 336 | presence = purple_buddy_get_presence(buddy); |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
337 | status = purple_presence_get_active_status(presence); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
338 | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
339 | message = purple_status_get_attr_string(status, "message"); |
|
12339
9333237efc4f
[gaim-migrate @ 14643]
Mark Doliner <markdoliner@pidgin.im>
parents:
12216
diff
changeset
|
340 | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
341 | if (message != NULL) { |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
342 | ret = g_markup_escape_text(message, -1); |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
343 | purple_util_chrreplace(ret, '\n', ' '); |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
344 | } |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
345 | |
|
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
346 | return ret; |
| 11477 | 347 | } |
| 348 | ||
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
349 | static void |
| 15884 | 350 | bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) |
| 11477 | 351 | { |
| 15884 | 352 | PurplePresence *presence; |
| 353 | PurpleStatus *status; | |
|
19219
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
354 | BonjourBuddy *bb = buddy->proto_data; |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
355 | const char *status_description; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
356 | const char *message; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
357 | |
| 15884 | 358 | presence = purple_buddy_get_presence(buddy); |
| 359 | status = purple_presence_get_active_status(presence); | |
| 360 | message = purple_status_get_attr_string(status, "message"); | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
361 | |
| 15884 | 362 | if (purple_presence_is_available(presence)) |
| 363 | status_description = purple_status_get_name(status); | |
| 364 | else if (purple_presence_is_idle(presence)) | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
365 | status_description = _("Idle"); |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
366 | else |
| 15884 | 367 | status_description = purple_status_get_name(status); |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
368 | |
| 15884 | 369 | purple_notify_user_info_add_pair(user_info, _("Status"), status_description); |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11515
diff
changeset
|
370 | if (message != NULL) |
| 15884 | 371 | purple_notify_user_info_add_pair(user_info, _("Message"), message); |
|
19219
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
372 | |
|
21720
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
373 | if (bb == NULL) { |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
374 | purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n"); |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
375 | return; |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
376 | } |
|
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
377 | |
|
19219
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
378 | /* Only show first/last name if there is a nickname set (to avoid duplication) */ |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
379 | if (bb->nick != NULL) { |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
380 | if (bb->first != NULL) |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
381 | purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
382 | if (bb->first != NULL) |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
383 | purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last); |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
384 | } |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
385 | |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
386 | if (bb->email != NULL) |
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23313
diff
changeset
|
387 | purple_notify_user_info_add_pair(user_info, _("Email"), bb->email); |
|
19219
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
388 | |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
389 | if (bb->AIM != NULL) |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
390 | purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM); |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
391 | |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
392 | if (bb->jid!= NULL) |
|
e1ef7cdd283a
Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents:
19218
diff
changeset
|
393 | purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); |
| 11477 | 394 | } |
| 395 | ||
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
396 | static void |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
397 | bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group) |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
398 | { |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
399 | PurpleBlistNodeFlags oldflags; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
400 | PurpleBuddy *buddy = purple_find_buddy(connection->account, who); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
401 | |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
402 | if (buddy == NULL) |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
403 | return; |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
404 | |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
405 | oldflags = purple_blist_node_get_flags((PurpleBlistNode *)buddy); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
406 | |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
407 | /* If we're moving them out of the bonjour group, make them persistent */ |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
408 | if (strcmp(new_group, BONJOUR_GROUP_NAME) == 0) |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
409 | purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags | PURPLE_BLIST_NODE_FLAG_NO_SAVE); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
410 | else |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
411 | purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags ^ PURPLE_BLIST_NODE_FLAG_NO_SAVE); |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
412 | |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
413 | } |
|
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
414 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
415 | static gboolean |
|
23259
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
416 | bonjour_can_receive_file(PurpleConnection *connection, const char *who) |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
417 | { |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
418 | PurpleBuddy *buddy = purple_find_buddy(connection->account, who); |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
419 | |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
420 | return (buddy != NULL && buddy->proto_data != NULL); |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
421 | |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
422 | } |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
423 | |
|
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
424 | static gboolean |
| 15884 | 425 | plugin_unload(PurplePlugin *plugin) |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
426 | { |
|
17660
23c712d0a795
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <datallah@pidgin.im>
parents:
17632
diff
changeset
|
427 | /* These shouldn't happen here because they are allocated in _init() */ |
|
23c712d0a795
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <datallah@pidgin.im>
parents:
17632
diff
changeset
|
428 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
429 | g_free(default_firstname); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
430 | g_free(default_lastname); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
431 | g_free(default_hostname); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
432 | |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
433 | return TRUE; |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
434 | } |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
435 | |
| 15884 | 436 | static PurplePlugin *my_protocol = NULL; |
| 11477 | 437 | |
| 15884 | 438 | static PurplePluginProtocolInfo prpl_info = |
| 11477 | 439 | { |
| 440 | OPT_PROTO_NO_PASSWORD, | |
| 441 | NULL, /* user_splits */ | |
| 442 | NULL, /* protocol_options */ | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
443 | {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
| 11477 | 444 | bonjour_list_icon, /* list_icon */ |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
445 | NULL, /* list_emblem */ |
| 11477 | 446 | bonjour_status_text, /* status_text */ |
| 447 | bonjour_tooltip_text, /* tooltip_text */ | |
| 448 | bonjour_status_types, /* status_types */ | |
| 449 | NULL, /* blist_node_menu */ | |
| 450 | NULL, /* chat_info */ | |
| 451 | NULL, /* chat_info_defaults */ | |
| 452 | bonjour_login, /* login */ | |
| 453 | bonjour_close, /* close */ | |
| 454 | bonjour_send_im, /* send_im */ | |
| 455 | NULL, /* set_info */ | |
| 456 | NULL, /* send_typing */ | |
| 457 | NULL, /* get_info */ | |
| 458 | bonjour_set_status, /* set_status */ | |
| 459 | NULL, /* set_idle */ | |
| 460 | NULL, /* change_passwd */ | |
|
21720
235394d5c7f4
Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
21614
diff
changeset
|
461 | bonjour_fake_add_buddy, /* add_buddy */ |
| 11477 | 462 | NULL, /* add_buddies */ |
|
19748
ae5eab65f8de
Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <datallah@pidgin.im>
parents:
19219
diff
changeset
|
463 | bonjour_remove_buddy, /* remove_buddy */ |
| 11477 | 464 | NULL, /* remove_buddies */ |
| 465 | NULL, /* add_permit */ | |
| 466 | NULL, /* add_deny */ | |
| 467 | NULL, /* rem_permit */ | |
| 468 | NULL, /* rem_deny */ | |
| 469 | NULL, /* set_permit_deny */ | |
| 470 | NULL, /* join_chat */ | |
| 471 | NULL, /* reject_chat */ | |
| 472 | NULL, /* get_chat_name */ | |
| 473 | NULL, /* chat_invite */ | |
| 474 | NULL, /* chat_leave */ | |
| 475 | NULL, /* chat_whisper */ | |
| 476 | NULL, /* chat_send */ | |
| 477 | NULL, /* keepalive */ | |
| 478 | NULL, /* register_user */ | |
| 479 | NULL, /* get_cb_info */ | |
| 480 | NULL, /* get_cb_away */ | |
| 481 | NULL, /* alias_buddy */ | |
|
23140
0e14208595bc
Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents:
23072
diff
changeset
|
482 | bonjour_group_buddy, /* group_buddy */ |
| 11477 | 483 | NULL, /* rename_group */ |
| 484 | NULL, /* buddy_free */ | |
| 485 | bonjour_convo_closed, /* convo_closed */ | |
| 486 | NULL, /* normalize */ | |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
487 | bonjour_set_buddy_icon, /* set_buddy_icon */ |
| 11477 | 488 | NULL, /* remove_group */ |
| 489 | NULL, /* get_cb_real_name */ | |
| 490 | NULL, /* set_chat_topic */ | |
| 491 | NULL, /* find_blist_chat */ | |
| 492 | NULL, /* roomlist_get_list */ | |
| 493 | NULL, /* roomlist_cancel */ | |
| 494 | NULL, /* roomlist_expand_category */ | |
|
23259
6186473f3370
Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents:
23233
diff
changeset
|
495 | bonjour_can_receive_file, /* can_receive_file */ |
|
21524
472e58992083
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
21503
diff
changeset
|
496 | bonjour_send_file, /* send_file */ |
|
472e58992083
Patch from some Intel folks to implement file transfer in Bonjour using XEP-0096 and 0065. This hopefully will work with Gaijm (haven't yet tested) and, of course, between libpurple instances; it will not work with Adium or iChat.
Daniel Atallah <datallah@pidgin.im>
parents:
21503
diff
changeset
|
497 | bonjour_new_xfer, /* new_xfer */ |
|
12650
ca70a14f4994
[gaim-migrate @ 14988]
Mark Doliner <markdoliner@pidgin.im>
parents:
12607
diff
changeset
|
498 | NULL, /* offline_message */ |
|
12607
4622f0adedf4
[gaim-migrate @ 14943]
Mark Doliner <markdoliner@pidgin.im>
parents:
12595
diff
changeset
|
499 | NULL, /* whiteboard_prpl_ops */ |
|
15217
53af6e98dfff
[gaim-migrate @ 17941]
Mark Doliner <markdoliner@pidgin.im>
parents:
14604
diff
changeset
|
500 | NULL, /* send_raw */ |
|
53af6e98dfff
[gaim-migrate @ 17941]
Mark Doliner <markdoliner@pidgin.im>
parents:
14604
diff
changeset
|
501 | NULL, /* roomlist_room_serialize */ |
|
22071
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
502 | NULL, /* unregister_user */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
503 | NULL, /* send_attention */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
504 | NULL, /* get_attention_types */ |
|
4c47e360e467
Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22069
diff
changeset
|
505 | sizeof(PurplePluginProtocolInfo), /* struct_size */ |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
506 | NULL, /* get_account_text_table */ |
|
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
507 | NULL, /* initiate_media */ |
|
22648
e286d795c5f9
Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22398
diff
changeset
|
508 | NULL /* can_do_media */ |
| 11477 | 509 | }; |
| 510 | ||
| 15884 | 511 | static PurplePluginInfo info = |
| 11477 | 512 | { |
| 15884 | 513 | PURPLE_PLUGIN_MAGIC, |
| 514 | PURPLE_MAJOR_VERSION, | |
| 515 | PURPLE_MINOR_VERSION, | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
516 | PURPLE_PLUGIN_PROTOCOL, /**< type */ |
| 11477 | 517 | NULL, /**< ui_requirement */ |
| 518 | 0, /**< flags */ | |
| 519 | NULL, /**< dependencies */ | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
520 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
| 11477 | 521 | |
| 522 | "prpl-bonjour", /**< id */ | |
| 523 | "Bonjour", /**< name */ | |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
20221
diff
changeset
|
524 | DISPLAY_VERSION, /**< version */ |
| 11477 | 525 | /** summary */ |
| 526 | N_("Bonjour Protocol Plugin"), | |
| 527 | /** description */ | |
| 528 | N_("Bonjour Protocol Plugin"), | |
| 529 | NULL, /**< author */ | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
530 | PURPLE_WEBSITE, /**< homepage */ |
| 11477 | 531 | |
| 532 | NULL, /**< load */ | |
|
19218
cb1f18ee620b
Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents:
19204
diff
changeset
|
533 | plugin_unload, /**< unload */ |
| 11477 | 534 | NULL, /**< destroy */ |
| 535 | ||
| 536 | NULL, /**< ui_info */ | |
| 537 | &prpl_info, /**< extra_info */ | |
| 538 | NULL, /**< prefs_info */ | |
|
16776
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
539 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
540 | |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
541 | /* padding */ |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
542 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
543 | NULL, |
|
c9301dd6aa1f
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents:
15996
diff
changeset
|
544 | NULL, |
| 11477 | 545 | NULL |
| 546 | }; | |
| 547 | ||
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
548 | #ifdef WIN32 |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
549 | static gboolean _set_default_name_cb(gpointer data) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
550 | gchar *fullname = data; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
551 | const char *splitpoint; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
552 | GList *tmp = prpl_info.protocol_options; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
553 | PurpleAccountOption *option; |
|
13192
77a782e38011
[gaim-migrate @ 15554]
Mark Doliner <markdoliner@pidgin.im>
parents:
13076
diff
changeset
|
554 | |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
555 | if (!fullname) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
556 | purple_debug_info("bonjour", "Unable to look up First and Last name or Username from system; using defaults.\n"); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
557 | return FALSE; |
|
13076
84dfc467ddbd
[gaim-migrate @ 15437]
Mark Doliner <markdoliner@pidgin.im>
parents:
13063
diff
changeset
|
558 | } |
|
84dfc467ddbd
[gaim-migrate @ 15437]
Mark Doliner <markdoliner@pidgin.im>
parents:
13063
diff
changeset
|
559 | |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
560 | g_free(default_firstname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
561 | g_free(default_lastname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
562 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
563 | /* Split the real name into a first and last name */ |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
564 | splitpoint = strchr(fullname, ' '); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
565 | if (splitpoint != NULL) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
566 | default_firstname = g_strndup(fullname, splitpoint - fullname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
567 | default_lastname = g_strdup(&splitpoint[1]); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
568 | } else { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
569 | default_firstname = g_strdup(fullname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
570 | default_lastname = g_strdup(""); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
571 | } |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
572 | g_free(fullname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
573 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
574 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
575 | for(; tmp != NULL; tmp = tmp->next) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
576 | option = tmp->data; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
577 | if (strcmp("first", purple_account_option_get_setting(option)) == 0) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
578 | purple_account_option_set_default_string(option, default_firstname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
579 | else if (strcmp("last", purple_account_option_get_setting(option)) == 0) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
580 | purple_account_option_set_default_string(option, default_lastname); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
581 | } |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
582 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
583 | return FALSE; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
584 | } |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
585 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
586 | static gpointer _win32_name_lookup_thread(gpointer data) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
587 | gchar *fullname = NULL; |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
588 | wchar_t username[UNLEN + 1]; |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
589 | DWORD dwLenUsername = UNLEN + 1; |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
590 | |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
591 | GetUserNameW((LPWSTR) &username, &dwLenUsername); |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
592 | |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
593 | if (username != NULL && *username != '\0') { |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
594 | LPBYTE servername = NULL; |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
595 | LPBYTE info = NULL; |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
596 | |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
597 | NetGetDCName(NULL, NULL, &servername); |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
598 | |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
599 | /* purple_debug_info("bonjour", "Looking up the full name from the %s.\n", (servername ? "domain controller" : "local machine")); */ |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
600 | |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
601 | if (NetUserGetInfo((LPCWSTR) servername, username, 10, &info) == NERR_Success |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
602 | && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
603 | && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
604 | fullname = g_utf16_to_utf8( |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
605 | ((LPUSER_INFO_10) info)->usri10_full_name, |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
606 | -1, NULL, NULL, NULL); |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
607 | } |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
608 | /* Fall back to the local machine if we didn't get the full name from the domain controller */ |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
609 | else if (servername != NULL) { |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
610 | /* purple_debug_info("bonjour", "Looking up the full name from the local machine"); */ |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
611 | |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
612 | if (info != NULL) NetApiBufferFree(info); |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
613 | info = NULL; |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
614 | |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
615 | if (NetUserGetInfo(NULL, username, 10, &info) == NERR_Success |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
616 | && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
617 | && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') { |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
618 | fullname = g_utf16_to_utf8( |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
619 | ((LPUSER_INFO_10) info)->usri10_full_name, |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
620 | -1, NULL, NULL, NULL); |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
621 | } |
|
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
622 | } |
|
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
623 | |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
624 | if (info != NULL) NetApiBufferFree(info); |
|
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
625 | if (servername != NULL) NetApiBufferFree(servername); |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
626 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
627 | if (!fullname) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
628 | fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL); |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
629 | } |
|
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
630 | |
|
20221
28e31ee832cd
applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents:
20200
diff
changeset
|
631 | purple_timeout_add(0, _set_default_name_cb, fullname); |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
632 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
633 | return NULL; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
634 | } |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
635 | #endif |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
636 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
637 | static void |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
21944
diff
changeset
|
638 | initialize_default_account_values(void) |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
639 | { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
640 | #ifndef _WIN32 |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
641 | struct passwd *info; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
642 | #endif |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
643 | const char *fullname = NULL, *splitpoint, *tmp; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
644 | gchar *conv = NULL; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
645 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
646 | #ifndef _WIN32 |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
647 | /* Try to figure out the user's real name */ |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
648 | info = getpwuid(getuid()); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
649 | if ((info != NULL) && (info->pw_gecos != NULL) && (info->pw_gecos[0] != '\0')) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
650 | fullname = info->pw_gecos; |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
651 | else if ((info != NULL) && (info->pw_name != NULL) && (info->pw_name[0] != '\0')) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
652 | fullname = info->pw_name; |
|
19842
4630c7f60cb9
We have got an empty fullname, set it to NULL so that we fall back to
Mark Doliner <markdoliner@pidgin.im>
parents:
19824
diff
changeset
|
653 | else if (((fullname = getlogin()) != NULL) && (fullname[0] == '\0')) |
|
4630c7f60cb9
We have got an empty fullname, set it to NULL so that we fall back to
Mark Doliner <markdoliner@pidgin.im>
parents:
19824
diff
changeset
|
654 | fullname = NULL; |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
655 | #else |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
656 | /* The Win32 username lookup functions are synchronous so we do it in a thread */ |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
657 | g_thread_create(_win32_name_lookup_thread, NULL, FALSE, NULL); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
658 | #endif |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
659 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
660 | /* Make sure fullname is valid UTF-8. If not, try to convert it. */ |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
661 | if (fullname != NULL && !g_utf8_validate(fullname, -1, NULL)) { |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
662 | fullname = conv = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL); |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
663 | if (conv == NULL || *conv == '\0') |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
664 | fullname = NULL; |
|
18844
257e1878df25
Bonjour only works on Windows2000 or newer, so we don't need to indirectly access the Net* functions. Avoid doing an unnecessary domain query to find the Domain Controller (which was causing a several second delay at startup). Also, try harder to avoid empty default names and falling back to "Purple Person".
Daniel Atallah <datallah@pidgin.im>
parents:
17663
diff
changeset
|
665 | } |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
666 | |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
667 | if (fullname == NULL) |
|
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
668 | fullname = _("Purple Person"); |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
669 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
670 | /* Split the real name into a first and last name */ |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
671 | splitpoint = strchr(fullname, ' '); |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
672 | if (splitpoint != NULL) { |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
673 | default_firstname = g_strndup(fullname, splitpoint - fullname); |
|
16823
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
674 | tmp = &splitpoint[1]; |
|
19204
ccc7ec4ea4dc
Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <datallah@pidgin.im>
parents:
18844
diff
changeset
|
675 | |
|
16823
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
676 | /* The last name may be followed by a comma and additional data. |
|
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
677 | * Only use the last name itself. |
|
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
678 | */ |
|
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
679 | splitpoint = strchr(tmp, ','); |
|
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
680 | if (splitpoint != NULL) |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
16961
diff
changeset
|
681 | default_lastname = g_strndup(tmp, splitpoint - tmp); |
|
16823
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
682 | else |
|
c505ca263924
The last name from /etc/passwd may have additional comma-delimited data which we should ignore when determining the default Bonjour name. Fixes #477
Evan Schoenberg <evands@pidgin.im>
parents:
16799
diff
changeset
|
683 | default_lastname = g_strdup(tmp); |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
684 | } else { |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
685 | default_firstname = g_strdup(fullname); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
686 | default_lastname = g_strdup(""); |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
687 | } |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
688 | |
|
19824
f99f468cda22
Lookup the default First and Last name values for bonjour on win32 in a thread to avoid delays when the plugin is being loaded. Apparently for some people the delay is quite significant when they're part of a domain, but the domain server isn't accessible.
Daniel Atallah <datallah@pidgin.im>
parents:
19748
diff
changeset
|
689 | g_free(conv); |
|
12003
6f6cbf74cb27
[gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents:
11984
diff
changeset
|
690 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
691 | /* Try to figure out a good host name to use */ |
|
13972
50b7226d8519
[gaim-migrate @ 16408]
Mark Doliner <markdoliner@pidgin.im>
parents:
13971
diff
changeset
|
692 | /* TODO: Avoid 'localhost,' if possible */ |
|
23850
b68e174fffc2
Add purple_get_host_name to get the hostname of the machine.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
23532
diff
changeset
|
693 | default_hostname = g_strdup(purple_get_host_name()); |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
694 | } |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
695 | |
|
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
696 | static void |
| 15884 | 697 | init_plugin(PurplePlugin *plugin) |
| 11477 | 698 | { |
| 15884 | 699 | PurpleAccountUserSplit *split; |
| 700 | PurpleAccountOption *option; | |
| 11477 | 701 | |
|
11984
0ac04d1651b6
[gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents:
11966
diff
changeset
|
702 | initialize_default_account_values(); |
| 11477 | 703 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
704 | /* Creating the user splits */ |
| 15884 | 705 | split = purple_account_user_split_new(_("Hostname"), default_hostname, '@'); |
| 11477 | 706 | prpl_info.user_splits = g_list_append(prpl_info.user_splits, split); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
707 | |
|
11829
8d89f3c00831
[gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents:
11718
diff
changeset
|
708 | /* Creating the options for the protocol */ |
| 15884 | 709 | option = purple_account_option_string_new(_("First name"), "first", default_firstname); |
| 11477 | 710 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 711 | ||
| 15884 | 712 | option = purple_account_option_string_new(_("Last name"), "last", default_lastname); |
| 11477 | 713 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 714 | ||
|
23325
a374a26fe217
Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents:
23313
diff
changeset
|
715 | option = purple_account_option_string_new(_("Email"), "email", ""); |
| 11477 | 716 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
717 | |
| 15884 | 718 | option = purple_account_option_string_new(_("AIM Account"), "AIM", ""); |
| 13968 | 719 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 720 | ||
|
16961
b6955f946f8f
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents:
16823
diff
changeset
|
721 | option = purple_account_option_string_new(_("XMPP Account"), "jid", ""); |
| 13968 | 722 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 723 | ||
| 11477 | 724 | my_protocol = plugin; |
| 725 | } | |
| 726 | ||
| 15884 | 727 | PURPLE_INIT_PLUGIN(bonjour, init_plugin, info); |
|
23707
480f94157418
propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
728 |