libpurple/protocols/bonjour/bonjour.c

Thu, 22 May 2014 16:07:39 +0200

author
Tomasz Wasilczyk <twasilczyk@pidgin.im>
date
Thu, 22 May 2014 16:07:39 +0200
changeset 36078
ad2b7d9cc0c3
parent 36076
a0e5b68ff4ef
child 36098
4951752ad038
permissions
-rw-r--r--

Remove dead send_whisper feature

11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
2 * purple - Bonjour Protocol Plugin
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
6 * source distribution.
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
7 *
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
11 * (at your option) any later version.
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
12 *
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
16 * GNU General Public License for more details.
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
17 *
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
21 */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
32
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
33 #include "internal.h"
13061
ab3ef8e402e4 [gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12970
diff changeset
34
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
35 #include "account.h"
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
39 #include "version.h"
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
40
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
43 #include "jabber.h"
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
44 #include "buddy.h"
34911
8b46f11b9e7e Refactored bonjour and irc to use the GObject xfer API
Ankit Vani <a@nevitus.org>
parents: 34910
diff changeset
45 #include "bonjour_ft.h"
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
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;
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
49
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
50 const char *
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
51 bonjour_get_jid(PurpleAccount *account)
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
52 {
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
53 PurpleConnection *conn = purple_account_get_connection(account);
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
54 BonjourData *bd = purple_connection_get_protocol_data(conn);
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
55 return bd->jid;
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
56 }
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
57
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
58 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
59 bonjour_removeallfromlocal(PurpleConnection *conn, PurpleGroup *bonjour_group)
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
60 {
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
61 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
62 PurpleBlistNode *cnode, *cnodenext, *bnode, *bnodenext;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
63 PurpleBuddy *buddy;
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
64
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
65 if (bonjour_group == NULL)
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
66 return;
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
67
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
68 /* Go through and remove all buddies that belong to this account */
24557
093de9cb395c Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@pidgin.im>
parents: 23850
diff changeset
69 for (cnode = purple_blist_node_get_first_child((PurpleBlistNode *) bonjour_group); cnode; cnode = cnodenext) {
093de9cb395c Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@pidgin.im>
parents: 23850
diff changeset
70 cnodenext = purple_blist_node_get_sibling_next(cnode);
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 33955
diff changeset
71 if (!PURPLE_IS_CONTACT(cnode))
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
72 continue;
24557
093de9cb395c Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@pidgin.im>
parents: 23850
diff changeset
73 for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = bnodenext) {
093de9cb395c Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@pidgin.im>
parents: 23850
diff changeset
74 bnodenext = purple_blist_node_get_sibling_next(bnode);
34696
6e0d13978666 Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents: 33955
diff changeset
75 if (!PURPLE_IS_BUDDY(bnode))
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
76 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
77 buddy = (PurpleBuddy *) bnode;
24557
093de9cb395c Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@pidgin.im>
parents: 23850
diff changeset
78 if (purple_buddy_get_account(buddy) != 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
79 continue;
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
80 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
81 purple_blist_remove_buddy(buddy);
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
82 }
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
83 }
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
84
11691
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
85 }
d46ace30ec7e [gaim-migrate @ 13977]
Mark Doliner <markdoliner@pidgin.im>
parents: 11539
diff changeset
86
12443
ad94864144f8 [gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12339
diff changeset
87 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
88 bonjour_login(PurpleAccount *account)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
89 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
90 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
91 BonjourData *bd;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
92 PurpleStatus *status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
93 PurplePresence *presence;
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
94
20200
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
95 #ifdef _WIN32
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
96 if (!dns_sd_available()) {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31595
diff changeset
97 purple_connection_error(gc,
27624
9dda0ba504a9 Change the wording in a connection error message. I'm trying to make
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
98 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
9dda0ba504a9 Change the wording in a connection error message. I'm trying to make
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
99 _("Unable to find Apple's \"Bonjour for Windows\" toolkit, see "
33955
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33883
diff changeset
100 "https://developer.pidgin.im/BonjourWindows for more "
55aa58076485 Use https URLs for pidgin.im and developer.pidgin.im.
Mark Doliner <mark@kingant.net>
parents: 33883
diff changeset
101 "information."));
20200
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
102 return;
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
103 }
27624
9dda0ba504a9 Change the wording in a connection error message. I'm trying to make
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
104 #endif /* _WIN32 */
20200
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
105
36055
33978dc8ef6f Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35812
diff changeset
106 purple_connection_set_flags(gc, PURPLE_CONNECTION_FLAG_HTML |
33978dc8ef6f Remove redundant OPT_PROTO_IM_IMAGE (use \!PURPLE_CONNECTION_FLAG_NO_IMAGES instead)
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35812
diff changeset
107 PURPLE_CONNECTION_FLAG_NO_IMAGES);
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
108 bd = g_new0(BonjourData, 1);
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
109 purple_connection_set_protocol_data(gc, bd);
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
110
11829
8d89f3c00831 [gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents: 11718
diff changeset
111 /* 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
112 bd->jabber_data = g_new0(BonjourJabber, 1);
29761
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 29757
diff changeset
113 bd->jabber_data->socket = -1;
0f6862f2782f Implementation of IPv6 support for Bonjour
Daniel Atallah <datallah@pidgin.im>
parents: 29757
diff changeset
114 bd->jabber_data->socket6 = -1;
25641
cf74c04c6f41 Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <datallah@pidgin.im>
parents: 25129
diff changeset
115 bd->jabber_data->port = purple_account_get_int(account, "port", BONJOUR_DEFAULT_PORT);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
116 bd->jabber_data->account = account;
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
117
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
118 if (bonjour_jabber_start(bd->jabber_data) == -1) {
11829
8d89f3c00831 [gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents: 11718
diff changeset
119 /* Send a message about the connection error */
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31595
diff changeset
120 purple_connection_error (gc,
27624
9dda0ba504a9 Change the wording in a connection error message. I'm trying to make
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
121 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
9dda0ba504a9 Change the wording in a connection error message. I'm trying to make
Mark Doliner <markdoliner@pidgin.im>
parents: 26482
diff changeset
122 _("Unable to listen for incoming IM connections"));
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
123 return;
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
124 }
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
125
11829
8d89f3c00831 [gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents: 11718
diff changeset
126 /* Connect to the mDNS daemon looking for buddies in the LAN */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
127 bd->dns_sd_data = bonjour_dns_sd_new();
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
128 bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
129 bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname));
13971
648326341d27 [gaim-migrate @ 16406]
Jonty Wareing
parents: 13968
diff changeset
130 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
131 /* 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
132 bd->dns_sd_data->vc = g_strdup("!");
11834
9c0104f0b8c3 [gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents: 11829
diff changeset
133
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
134 status = purple_account_get_active_status(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
135 presence = purple_account_get_presence(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
136 if (purple_presence_is_available(presence))
11834
9c0104f0b8c3 [gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents: 11829
diff changeset
137 bd->dns_sd_data->status = g_strdup("avail");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
138 else if (purple_presence_is_idle(presence))
11834
9c0104f0b8c3 [gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents: 11829
diff changeset
139 bd->dns_sd_data->status = g_strdup("away");
9c0104f0b8c3 [gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents: 11829
diff changeset
140 else
9c0104f0b8c3 [gaim-migrate @ 14125]
Mark Doliner <markdoliner@pidgin.im>
parents: 11829
diff changeset
141 bd->dns_sd_data->status = g_strdup("dnd");
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
142 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
143
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
144 bd->dns_sd_data->account = account;
11927
f9ede13499d0 [gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents: 11841
diff changeset
145 if (!bonjour_dns_sd_start(bd->dns_sd_data))
f9ede13499d0 [gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents: 11841
diff changeset
146 {
32157
39ba2e2492ee Rename purple_connection_error_reason to purple_connection_error
Mark Doliner <markdoliner@pidgin.im>
parents: 31595
diff changeset
147 purple_connection_error (gc,
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21160
diff changeset
148 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
149 _("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
150 return;
f9ede13499d0 [gaim-migrate @ 14218]
Mark Doliner <markdoliner@pidgin.im>
parents: 11841
diff changeset
151 }
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
152
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
153 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
154
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
155 /* Show the buddy list by telling Purple we have already connected */
34746
dc9c911dbd35 Started GObjectification of PurpleConnection.
Ankit Vani <a@nevitus.org>
parents: 34728
diff changeset
156 purple_connection_set_state(gc, PURPLE_CONNECTION_CONNECTED);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
157 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
158
12443
ad94864144f8 [gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12339
diff changeset
159 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
160 bonjour_close(PurpleConnection *connection)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
161 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
162 PurpleGroup *bonjour_group;
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
163 BonjourData *bd = purple_connection_get_protocol_data(connection);
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
164
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
165 bonjour_group = purple_blist_find_group(BONJOUR_GROUP_NAME);
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
166
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
167 /* 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
168 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
169
11829
8d89f3c00831 [gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents: 11718
diff changeset
170 /* Stop looking for buddies in the LAN */
20200
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
171 if (bd != NULL && bd->dns_sd_data != NULL)
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
172 {
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
173 bonjour_dns_sd_stop(bd->dns_sd_data);
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
174 bonjour_dns_sd_free(bd->dns_sd_data);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
175 }
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
176
20200
21898c919046 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19859
diff changeset
177 if (bd != NULL && bd->jabber_data != NULL)
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
178 {
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
179 /* Stop waiting for conversations */
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
180 bonjour_jabber_stop(bd->jabber_data);
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
181 g_free(bd->jabber_data);
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
182 }
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
183
30250
6ada12bfce6d Fix a status change event being triggered for each online Bonjour buddy when you sign out.
Daniel Atallah <datallah@pidgin.im>
parents: 30138
diff changeset
184 /* Delete the bonjour group
6ada12bfce6d Fix a status change event being triggered for each online Bonjour buddy when you sign out.
Daniel Atallah <datallah@pidgin.im>
parents: 30138
diff changeset
185 * (purple_blist_remove_group will bail out if the group isn't empty)
6ada12bfce6d Fix a status change event being triggered for each online Bonjour buddy when you sign out.
Daniel Atallah <datallah@pidgin.im>
parents: 30138
diff changeset
186 */
13063
0dcbcfe1c9d7 [gaim-migrate @ 15425]
David Schmitt
parents: 13061
diff changeset
187 if (bonjour_group != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
188 purple_blist_remove_group(bonjour_group);
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
189
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
190 /* 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
191 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
192 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
193 }
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
194
30875
37e57d4ba633 Fix crash when attempting to log into a bonjour account and init failed
Daniel Atallah <datallah@pidgin.im>
parents: 30825
diff changeset
195 if (bd != NULL)
37e57d4ba633 Fix crash when attempting to log into a bonjour account and init failed
Daniel Atallah <datallah@pidgin.im>
parents: 30825
diff changeset
196 g_free(bd->jid);
20221
28e31ee832cd applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 20200
diff changeset
197 g_free(bd);
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
198 purple_connection_set_protocol_data(connection, NULL);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
199 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
200
12443
ad94864144f8 [gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12339
diff changeset
201 static const char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
202 bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
203 {
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
204 return BONJOUR_ICON_NAME;
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
205 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
206
12443
ad94864144f8 [gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12339
diff changeset
207 static int
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
208 bonjour_send_im(PurpleConnection *connection, PurpleMessage *msg)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
209 {
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
210 BonjourData *bd = purple_connection_get_protocol_data(connection);
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
211
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
212 if (purple_message_is_empty(msg) || !purple_message_get_who(msg))
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
213 return 0;
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
214
36076
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
215 return bonjour_jabber_send_message(bd->jabber_data,
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
216 purple_message_get_who(msg),
a0e5b68ff4ef Switch purple_serv_send_im to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 36055
diff changeset
217 purple_message_get_contents(msg));
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
218 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
219
12443
ad94864144f8 [gaim-migrate @ 14750]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 12339
diff changeset
220 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
221 bonjour_set_status(PurpleAccount *account, PurpleStatus *status)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
222 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
223 PurpleConnection *gc;
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
224 BonjourData *bd;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
225 PurplePresence *presence;
11841
85773b4974fe [gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11839
diff changeset
226 const char *message, *bonjour_status;
13061
ab3ef8e402e4 [gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12970
diff changeset
227 gchar *stripped;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
228
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
229 gc = purple_account_get_connection(account);
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
230 bd = purple_connection_get_protocol_data(gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
231 presence = purple_account_get_presence(account);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
232
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
233 message = purple_status_get_attr_string(status, "message");
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
234 if (message == NULL)
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
235 message = "";
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
236 stripped = purple_markup_strip_html(message);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
237
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
238 /*
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
239 * The three possible status for Bonjour are
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
240 * -available ("avail")
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
241 * -idle ("away")
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
242 * -away ("dnd")
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
243 * Each of them can have an optional message.
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
244 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
245 if (purple_presence_is_available(presence))
11841
85773b4974fe [gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11839
diff changeset
246 bonjour_status = "avail";
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
247 else if (purple_presence_is_idle(presence))
11841
85773b4974fe [gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11839
diff changeset
248 bonjour_status = "away";
11835
da95d476b481 [gaim-migrate @ 14126]
Mark Doliner <markdoliner@pidgin.im>
parents: 11834
diff changeset
249 else
11841
85773b4974fe [gaim-migrate @ 14132]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11839
diff changeset
250 bonjour_status = "dnd";
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
251
13061
ab3ef8e402e4 [gaim-migrate @ 15423]
Mark Doliner <markdoliner@pidgin.im>
parents: 12970
diff changeset
252 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
253 g_free(stripped);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
254 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
255
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
256 /*
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 * 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
258 * 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
259 * 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
260 * 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
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 static void
32315
2550a39e0285 Rename the _with_invite functions to their counterparts.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32260
diff changeset
263 bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message) {
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
264 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
265 "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
266 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
267
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21614
diff changeset
268 /* 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
269
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21614
diff changeset
270 /* 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
271 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
272 }
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21614
diff changeset
273
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21614
diff changeset
274
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
275 static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) {
24935
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
276 BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy);
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
277 if (bb) {
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
278 bonjour_buddy_delete(bb);
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
279 purple_buddy_set_protocol_data(buddy, NULL);
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
280 }
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
281 }
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
282
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
283 static GList *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
284 bonjour_status_types(PurpleAccount *account)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
285 {
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
286 GList *status_types = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
287 PurpleStatusType *type;
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
288
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
289 g_return_val_if_fail(account != NULL, NULL);
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
290
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
291 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
292 BONJOUR_STATUS_ID_AVAILABLE,
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12489
diff changeset
293 NULL, TRUE, TRUE, FALSE,
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
294 "message", _("Message"),
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34911
diff changeset
295 purple_value_new(G_TYPE_STRING), NULL);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
296 status_types = g_list_append(status_types, type);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
297
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
298 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
299 BONJOUR_STATUS_ID_AWAY,
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12489
diff changeset
300 NULL, TRUE, TRUE, FALSE,
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
301 "message", _("Message"),
35005
bff56dfca65d Renamed purple_g_value_* to purple_value_*
Ankit Vani <a@nevitus.org>
parents: 34911
diff changeset
302 purple_value_new(G_TYPE_STRING), NULL);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
303 status_types = g_list_append(status_types, type);
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
304
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
305 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
12658
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12650
diff changeset
306 BONJOUR_STATUS_ID_OFFLINE,
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12650
diff changeset
307 NULL, TRUE, TRUE, FALSE);
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12650
diff changeset
308 status_types = g_list_append(status_types, type);
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12650
diff changeset
309
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
310 return status_types;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
311 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
312
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
313 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
314 bonjour_convo_closed(PurpleConnection *connection, const char *who)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
315 {
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
316 PurpleBuddy *buddy = purple_blist_find_buddy(purple_connection_get_account(connection), 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
317 BonjourBuddy *bb;
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
318
24935
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
319 if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL)
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12489
diff changeset
320 {
11966
ad12fc2943ca [gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents: 11927
diff changeset
321 /*
ad12fc2943ca [gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents: 11927
diff changeset
322 * 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
323 * exist, so we won't have any data about them.
ad12fc2943ca [gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents: 11927
diff changeset
324 */
ad12fc2943ca [gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents: 11927
diff changeset
325 return;
12595
8108c22aa723 [gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents: 12489
diff changeset
326 }
11966
ad12fc2943ca [gaim-migrate @ 14258]
Mark Doliner <markdoliner@pidgin.im>
parents: 11927
diff changeset
327
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
328 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
329 bb->conversation = NULL;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
330 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
331
35812
48c6ee645ca1 Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35005
diff changeset
332 static void
48c6ee645ca1 Imgstore vs PurpleImage: rip and fix
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 35005
diff changeset
333 bonjour_set_buddy_icon(PurpleConnection *conn, PurpleImage *img)
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
334 {
32260
5b0ecccb3bbb Convert bonjour prpl to use accessor functions purple_connection_get_protocol_data() and purple_connection_set_protocol_data().
Andrew Victor <andrew.victor@mxit.com>
parents: 32191
diff changeset
335 BonjourData *bd = purple_connection_get_protocol_data(conn);
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
336 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
337 }
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
338
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
339
11539
fbabe3f89777 [gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents: 11519
diff changeset
340 static char *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
341 bonjour_status_text(PurpleBuddy *buddy)
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
342 {
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
343 const PurplePresence *presence;
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
344 const PurpleStatus *status;
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
345 const char *message;
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
346 gchar *ret = NULL;
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
347
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
348 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
349 status = purple_presence_get_active_status(presence);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
350
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
351 message = purple_status_get_attr_string(status, "message");
12339
9333237efc4f [gaim-migrate @ 14643]
Mark Doliner <markdoliner@pidgin.im>
parents: 12216
diff changeset
352
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
353 if (message != NULL) {
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
354 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
355 purple_util_chrreplace(ret, '\n', ' ');
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
356 }
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
357
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
358 return ret;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
359 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
360
12970
c2f3b4dcf711 [gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
361 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
362 bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
363 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
364 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
365 PurpleStatus *status;
24935
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
366 BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
367 const char *status_description;
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
368 const char *message;
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
369
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
370 presence = purple_buddy_get_presence(buddy);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
371 status = purple_presence_get_active_status(presence);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
372 message = purple_status_get_attr_string(status, "message");
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
373
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
374 if (purple_presence_is_available(presence))
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
375 status_description = purple_status_get_name(status);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
376 else if (purple_presence_is_idle(presence))
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
377 status_description = _("Idle");
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
378 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
379 status_description = purple_status_get_name(status);
11496
0f61069a4a3f [gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents: 11477
diff changeset
380
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
381 purple_notify_user_info_add_pair_plaintext(user_info, _("Status"), status_description);
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
382 if (message != NULL) {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
383 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
384 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
385 purple_notify_user_info_add_pair_html(user_info, _("Message"), message);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
386 }
19219
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
387
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
388 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
389 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
390 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
391 }
235394d5c7f4 Pull a bunch of bugfix only changes to im.pidgin.pidgin.2.3.1,
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 21614
diff changeset
392
19219
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
393 /* Only show first/last name if there is a nickname set (to avoid duplication) */
25129
476e928f6127 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
394 if (bb->nick != NULL && *bb->nick != '\0') {
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
395 if (bb->first != NULL && *bb->first != '\0') {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
396 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
397 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
398 purple_notify_user_info_add_pair_html(user_info, _("First name"), bb->first);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
399 }
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
400 if (bb->last != NULL && *bb->last != '\0') {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
401 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
402 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
403 purple_notify_user_info_add_pair_html(user_info, _("Last name"), bb->last);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
404 }
19219
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
405 }
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
406
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
407 if (bb->email != NULL && *bb->email != '\0') {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
408 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
409 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
410 purple_notify_user_info_add_pair_html(user_info, _("Email"), bb->email);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
411 }
19219
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
412
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
413 if (bb->AIM != NULL && *bb->AIM != '\0') {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
414 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
415 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
416 purple_notify_user_info_add_pair_html(user_info, _("AIM Account"), bb->AIM);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
417 }
19219
e1ef7cdd283a Add data to the bonjour tooltip.
Daniel Atallah <datallah@pidgin.im>
parents: 19218
diff changeset
418
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
419 if (bb->jid != NULL && *bb->jid != '\0') {
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
420 /* TODO: Check whether it's correct to call add_pair_html,
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
421 or if we should be using add_pair_plaintext */
32191
a4668d9dc8d1 Rename purple_notify_user_info_add_pair to
Mark Doliner <markdoliner@pidgin.im>
parents: 32188
diff changeset
422 purple_notify_user_info_add_pair_html(user_info, _("XMPP Account"), bb->jid);
32188
cb9cad610bc6 I went through all our calls to purple_notify_user_info_add_pair() and
Mark Doliner <markdoliner@pidgin.im>
parents: 32157
diff changeset
423 }
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
424 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
425
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
426 static void
34697
fde4eb63fab0 Refactored protocols with initial GObject blist API
Ankit Vani <a@nevitus.org>
parents: 34696
diff changeset
427 bonjour_do_group_change(PurpleBuddy *buddy, const char *new_group)
fde4eb63fab0 Refactored protocols with initial GObject blist API
Ankit Vani <a@nevitus.org>
parents: 34696
diff changeset
428 {
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
429 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
430 return;
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
431
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
432 /* If we're moving them out of the bonjour group, make them persistent */
29190
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
433 if (purple_strequal(new_group, BONJOUR_GROUP_NAME))
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
434 purple_blist_node_set_transient(PURPLE_BLIST_NODE(buddy), TRUE);
23140
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
435 else
34865
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
436 purple_blist_node_set_transient(PURPLE_BLIST_NODE(buddy),
764a33b41ac7 Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents: 34864
diff changeset
437 !purple_blist_node_is_transient(PURPLE_BLIST_NODE(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
438
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
439 }
0e14208595bc Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <datallah@pidgin.im>
parents: 23072
diff changeset
440
29190
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
441 static void
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
442 bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group)
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
443 {
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
444 PurpleBuddy *buddy = purple_blist_find_buddy(purple_connection_get_account(connection), who);
29190
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
445
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
446 bonjour_do_group_change(buddy, new_group);
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
447
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
448 }
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
449
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
450 static void
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
451 bonjour_rename_group(PurpleConnection *connection, const char *old_name, PurpleGroup *group, GList *moved_buddies)
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
452 {
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
453 GList *cur;
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
454 const char *new_group;
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
455 PurpleBuddy *buddy;
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
456
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
457 new_group = purple_group_get_name(group);
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
458
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
459 for (cur = moved_buddies; cur; cur = cur->next) {
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
460 buddy = cur->data;
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
461 bonjour_do_group_change(buddy, new_group);
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
462 }
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
463
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
464 }
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
465
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
466 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
467 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
468 {
34728
8efd73063ecf Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents: 34699
diff changeset
469 PurpleBuddy *buddy = purple_blist_find_buddy(purple_connection_get_account(connection), who);
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
470
24935
b9a3603e84c0 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@pidgin.im>
parents: 24557
diff changeset
471 return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL);
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
472 }
6186473f3370 Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <datallah@pidgin.im>
parents: 23233
diff changeset
473
34321
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
474 static gssize
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
475 bonjour_get_max_message_size(PurpleConversation *conv)
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
476 {
34321
f60fcab02bd4 Reconsidered characters count callback for prpl API: make it per-conversation and distinguish infinite from undefined
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents: 34312
diff changeset
477 return -1; /* 5MB successfully tested. */
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
478 }
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
479
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
480 static gboolean
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
481 plugin_unload(PurplePlugin *plugin)
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
482 {
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
483 /* 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
484
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
485 g_free(default_firstname);
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
486 g_free(default_lastname);
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
487
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
488 return TRUE;
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
489 }
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
490
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
491 static PurplePlugin *my_protocol = NULL;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
492
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
493 static PurplePluginProtocolInfo prpl_info =
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
494 {
32316
21dab55b4699 Move struct_size to the beginning of the struct. Even if we don't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 32315
diff changeset
495 sizeof(PurplePluginProtocolInfo), /* struct_size */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
496 OPT_PROTO_NO_PASSWORD,
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
497 NULL, /* user_splits */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
498 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
499 {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
500 bonjour_list_icon, /* list_icon */
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
501 NULL, /* list_emblem */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
502 bonjour_status_text, /* status_text */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
503 bonjour_tooltip_text, /* tooltip_text */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
504 bonjour_status_types, /* status_types */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
505 NULL, /* blist_node_menu */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
506 NULL, /* chat_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
507 NULL, /* chat_info_defaults */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
508 bonjour_login, /* login */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
509 bonjour_close, /* close */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
510 bonjour_send_im, /* send_im */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
511 NULL, /* set_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
512 NULL, /* send_typing */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
513 NULL, /* get_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
514 bonjour_set_status, /* set_status */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
515 NULL, /* set_idle */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
516 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
517 bonjour_fake_add_buddy, /* add_buddy */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
518 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
519 bonjour_remove_buddy, /* remove_buddy */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
520 NULL, /* remove_buddies */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
521 NULL, /* add_permit */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
522 NULL, /* add_deny */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
523 NULL, /* rem_permit */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
524 NULL, /* rem_deny */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
525 NULL, /* set_permit_deny */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
526 NULL, /* join_chat */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
527 NULL, /* reject_chat */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
528 NULL, /* get_chat_name */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
529 NULL, /* chat_invite */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
530 NULL, /* chat_leave */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
531 NULL, /* chat_send */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
532 NULL, /* keepalive */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
533 NULL, /* register_user */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
534 NULL, /* get_cb_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
535 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
536 bonjour_group_buddy, /* group_buddy */
29190
687f7ba1905b Allow the "Bonjour" group to be renamed and function similarly to dragging the buddies into a different group. Fixes #11052
Daniel Atallah <datallah@pidgin.im>
parents: 27624
diff changeset
537 bonjour_rename_group, /* rename_group */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
538 NULL, /* buddy_free */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
539 bonjour_convo_closed, /* convo_closed */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
540 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
541 bonjour_set_buddy_icon, /* set_buddy_icon */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
542 NULL, /* remove_group */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
543 NULL, /* get_cb_real_name */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
544 NULL, /* set_chat_topic */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
545 NULL, /* find_blist_chat */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
546 NULL, /* roomlist_get_list */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
547 NULL, /* roomlist_cancel */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
548 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
549 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
550 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
551 bonjour_new_xfer, /* new_xfer */
12650
ca70a14f4994 [gaim-migrate @ 14988]
Mark Doliner <markdoliner@pidgin.im>
parents: 12607
diff changeset
552 NULL, /* offline_message */
12607
4622f0adedf4 [gaim-migrate @ 14943]
Mark Doliner <markdoliner@pidgin.im>
parents: 12595
diff changeset
553 NULL, /* whiteboard_prpl_ops */
15217
53af6e98dfff [gaim-migrate @ 17941]
Mark Doliner <markdoliner@pidgin.im>
parents: 14604
diff changeset
554 NULL, /* send_raw */
53af6e98dfff [gaim-migrate @ 17941]
Mark Doliner <markdoliner@pidgin.im>
parents: 14604
diff changeset
555 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
556 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
557 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
558 NULL, /* get_attention_types */
23707
480f94157418 propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23325 22648
diff changeset
559 NULL, /* get_account_text_table */
480f94157418 propagate from branch 'im.pidgin.pidgin' (head bd5f7f61d9349053ee4738efc0d17453f0574057)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 23325 22648
diff changeset
560 NULL, /* initiate_media */
29757
f137c1386384 Add a NULL for PurplePluginProtocolInfo::get_moods to all the plugins I build
Paul Aurich <darkrain42@pidgin.im>
parents: 29190
diff changeset
561 NULL, /* get_media_caps */
30138
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 29761
diff changeset
562 NULL, /* get_moods */
cca9685df785 Add purple_account_[gs]et_public_alias functions, per discussion in d@cpi
Paul Aurich <darkrain42@pidgin.im>
parents: 29761
diff changeset
563 NULL, /* set_public_alias */
34312
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
564 NULL, /* get_public_alias */
4461d5c1e61c Extend prpl with max message length callback
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 33955
diff changeset
565 bonjour_get_max_message_size /* get_max_message_size */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
566 };
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
567
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
568 static PurplePluginInfo info =
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
569 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
570 PURPLE_PLUGIN_MAGIC,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
571 PURPLE_MAJOR_VERSION,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
572 PURPLE_MINOR_VERSION,
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
573 PURPLE_PLUGIN_PROTOCOL, /**< type */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
574 NULL, /**< ui_requirement */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
575 0, /**< flags */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
576 NULL, /**< dependencies */
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
577 PURPLE_PRIORITY_DEFAULT, /**< priority */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
578
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
579 "prpl-bonjour", /**< id */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
580 "Bonjour", /**< name */
20288
5ca925a094e2 applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 20221
diff changeset
581 DISPLAY_VERSION, /**< version */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
582 /** summary */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
583 N_("Bonjour Protocol Plugin"),
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
584 /** description */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
585 N_("Bonjour Protocol Plugin"),
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
586 NULL, /**< author */
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
587 PURPLE_WEBSITE, /**< homepage */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
588
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
589 NULL, /**< load */
19218
cb1f18ee620b Show bonjour status messages in the buddy list.
Daniel Atallah <datallah@pidgin.im>
parents: 19204
diff changeset
590 plugin_unload, /**< unload */
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
591 NULL, /**< destroy */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
592
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
593 NULL, /**< ui_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
594 &prpl_info, /**< extra_info */
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
595 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
596 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
597
c9301dd6aa1f Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <markdoliner@pidgin.im>
parents: 15996
diff changeset
598 /* 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
599 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
600 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
601 NULL,
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
602 NULL
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
603 };
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
604
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
605 #ifdef WIN32
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
606 static gboolean
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
607 _set_default_name_cb(gpointer data) {
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
608 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
609 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
610 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
611 PurpleAccountOption *option;
13192
77a782e38011 [gaim-migrate @ 15554]
Mark Doliner <markdoliner@pidgin.im>
parents: 13076
diff changeset
612
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
613 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
614 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
615 return FALSE;
13076
84dfc467ddbd [gaim-migrate @ 15437]
Mark Doliner <markdoliner@pidgin.im>
parents: 13063
diff changeset
616 }
84dfc467ddbd [gaim-migrate @ 15437]
Mark Doliner <markdoliner@pidgin.im>
parents: 13063
diff changeset
617
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
618 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
619 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
620
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
621 /* 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
622 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
623 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
624 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
625 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
626 } 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
627 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
628 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
629 }
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
630 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
631
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 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
634 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
635 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
636 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
637 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
638 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
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
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 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
642 }
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
30825
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
644 static gpointer
87a79bbdc985 The hostname used for a bonjour account should always be the current machine
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
645 _win32_name_lookup_thread(gpointer data) {
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
646 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
647 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
648 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
649
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
650 GetUserNameW((LPWSTR) &username, &dwLenUsername);
12003
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
651
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
652 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
653 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
654 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
655
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
656 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
657
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
658 /* 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
659
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
660 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
661 && 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
662 && *(((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
663 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
664 ((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
665 -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
666 }
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
667 /* 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
668 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
669 /* 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
670
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
671 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
672 info = NULL;
12003
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
673
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
674 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
675 && 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
676 && *(((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
677 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
678 ((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
679 -1, NULL, NULL, NULL);
12003
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
680 }
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
681 }
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
682
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
683 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
684 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
685
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
686 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
687 fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL);
12003
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
688 }
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
689
20221
28e31ee832cd applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 20200
diff changeset
690 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
691
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
692 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
693 }
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
694 #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
695
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
696 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
697 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
698 {
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
699 #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
700 struct passwd *info;
33883
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
701 #else
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
702 GThread *lookup_thread;
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
703 #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
704 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
705 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
706
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
707 #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
708 /* 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
709 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
710 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
711 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
712 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
713 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
714 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
715 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
716 #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
717 /* The Win32 username lookup functions are synchronous so we do it in a thread */
33883
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
718 lookup_thread = g_thread_try_new("bonjour dns thread", _win32_name_lookup_thread, NULL, NULL);
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
719 if (lookup_thread)
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
720 g_thread_unref(lookup_thread);
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
721 else
8a0d96bd9cf4 Replace deprecated g_thread_create with g_thread_try_new
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents: 32678
diff changeset
722 purple_debug_fatal("bonjour", "failed to create lookup thread\n");
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
723 #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
724
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
725 /* 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
726 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
727 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
728 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
729 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
730 }
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
731
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
732 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
733 fullname = _("Purple Person");
12003
6f6cbf74cb27 [gaim-migrate @ 14296]
Daniel Atallah <datallah@pidgin.im>
parents: 11984
diff changeset
734
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
735 /* Split the real name into a first and last name */
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
736 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
737 if (splitpoint != NULL) {
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
738 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
739 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
740
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
741 /* 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
742 * 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
743 */
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
744 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
745 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
746 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
747 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
748 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
749 } else {
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
750 default_firstname = g_strdup(fullname);
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
751 default_lastname = g_strdup("");
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
752 }
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
753
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
754 g_free(conv);
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
755 }
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
756
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
757 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
758 init_plugin(PurplePlugin *plugin)
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
759 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
760 PurpleAccountOption *option;
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
761
11984
0ac04d1651b6 [gaim-migrate @ 14277]
Mark Doliner <markdoliner@pidgin.im>
parents: 11966
diff changeset
762 initialize_default_account_values();
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
763
11829
8d89f3c00831 [gaim-migrate @ 14120]
Richard Laager <rlaager@pidgin.im>
parents: 11718
diff changeset
764 /* Creating the options for the protocol */
25641
cf74c04c6f41 Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <datallah@pidgin.im>
parents: 25129
diff changeset
765 option = purple_account_option_int_new(_("Local Port"), "port", BONJOUR_DEFAULT_PORT);
cf74c04c6f41 Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <datallah@pidgin.im>
parents: 25129
diff changeset
766 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
cf74c04c6f41 Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <datallah@pidgin.im>
parents: 25129
diff changeset
767
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
768 option = purple_account_option_string_new(_("First name"), "first", default_firstname);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
769 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
770
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
771 option = purple_account_option_string_new(_("Last name"), "last", default_lastname);
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
772 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
773
23325
a374a26fe217 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@pidgin.im>
parents: 23313
diff changeset
774 option = purple_account_option_string_new(_("Email"), "email", "");
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
775 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
776
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
777 option = purple_account_option_string_new(_("AIM Account"), "AIM", "");
13968
45f6a17eca9b [gaim-migrate @ 16400]
Jonty Wareing
parents: 13546
diff changeset
778 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
45f6a17eca9b [gaim-migrate @ 16400]
Jonty Wareing
parents: 13546
diff changeset
779
16961
b6955f946f8f s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@pidgin.im>
parents: 16823
diff changeset
780 option = purple_account_option_string_new(_("XMPP Account"), "jid", "");
13968
45f6a17eca9b [gaim-migrate @ 16400]
Jonty Wareing
parents: 13546
diff changeset
781 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
45f6a17eca9b [gaim-migrate @ 16400]
Jonty Wareing
parents: 13546
diff changeset
782
11477
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
783 my_protocol = plugin;
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
784 }
98b4f8643569 [gaim-migrate @ 13719]
Mark Doliner <markdoliner@pidgin.im>
parents:
diff changeset
785
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15872
diff changeset
786 PURPLE_INIT_PLUGIN(bonjour, init_plugin, info);

mercurial