annotate libpurple/protocols/bonjour/bonjour.c @ 27452:97947f51b221

Change the wording in a connection error message. I'm trying to make these a bit more uniform, and I think this is easier to read. And remove a newline from the end of another connection error message.
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jul 2009 05:18:34 +0000
parents e23a74d7c97c
children 8aebd0e204e5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
2 * purple - Bonjour Protocol Plugin
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19663
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include <glib.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23 #ifndef _WIN32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include <pwd.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25 #else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #define UNICODE
22909
1c87e81c44fa Bonjour build fixes for MSVC.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22228
diff changeset
27 #include <winsock2.h>
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include <windows.h>
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include <lm.h>
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
30 #include "dns_sd_proxy.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "accountopt.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "debug.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "version.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include "bonjour.h"
17733
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents: 16915
diff changeset
42 #include "mdns_common.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43 #include "jabber.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "buddy.h"
21437
db7fa42845f6 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 <daniel.atallah@gmail.com>
parents: 21418
diff changeset
45 #include "bonjour_ft.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 static char *default_firstname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 static char *default_lastname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 static char *default_hostname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 static void
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
52 bonjour_removeallfromlocal(PurpleConnection *conn, PurpleGroup *bonjour_group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 {
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
54 PurpleAccount *account = purple_connection_get_account(conn);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
55 PurpleBlistNode *cnode, *cnodenext, *bnode, *bnodenext;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
56 PurpleBuddy *buddy;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
58 if (bonjour_group == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 /* Go through and remove all buddies that belong to this account */
24280
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
62 for (cnode = purple_blist_node_get_first_child((PurpleBlistNode *) bonjour_group); cnode; cnode = cnodenext) {
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
63 cnodenext = purple_blist_node_get_sibling_next(cnode);
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
64 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
65 continue;
24280
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
66 for (bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = bnodenext) {
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
67 bnodenext = purple_blist_node_get_sibling_next(bnode);
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
68 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69 continue;
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
70 buddy = (PurpleBuddy *) bnode;
24280
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
71 if (purple_buddy_get_account(buddy) != account)
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
72 continue;
24280
c06b85e1d020 Fix Bonjour to work with the hidden structs, except for proto_data.
Richard Laager <rlaager@wiktel.com>
parents: 23583
diff changeset
73 purple_prpl_got_user_status(account, purple_buddy_get_name(buddy), "offline", NULL);
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
74 purple_account_remove_buddy(account, buddy, NULL);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
75 purple_blist_remove_buddy(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 }
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
78
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
82 bonjour_login(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
84 PurpleConnection *gc = purple_account_get_connection(account);
17779
a62a695ccfb5 Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17739
diff changeset
85 BonjourData *bd;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
86 PurpleStatus *status;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
87 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
89 #ifdef _WIN32
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
90 if (!dns_sd_available()) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
91 purple_connection_error_reason(gc,
27452
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
92 PURPLE_CONNECTION_ERROR_OTHER_ERROR,
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
93 _("Unable to find Apple's \"Bonjour for Windows\" toolkit, see "
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
94 "http://d.pidgin.im/BonjourWindows for more information."));
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
95 return;
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
96 }
27452
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
97 #endif /* _WIN32 */
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
98
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
99 gc->flags |= PURPLE_CONNECTION_HTML;
17779
a62a695ccfb5 Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17739
diff changeset
100 gc->proto_data = bd = g_new0(BonjourData, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 /* Start waiting for jabber connections (iChat style) */
21829
cc0809ec0c85 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 <daniel.atallah@gmail.com>
parents: 21654
diff changeset
103 bd->jabber_data = g_new0(BonjourJabber, 1);
25131
f38799160cfa Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24654
diff changeset
104 bd->jabber_data->port = purple_account_get_int(account, "port", BONJOUR_DEFAULT_PORT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 bd->jabber_data->account = account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 if (bonjour_jabber_start(bd->jabber_data) == -1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 /* Send a message about the connection error */
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
109 purple_connection_error_reason (gc,
27452
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
110 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
97947f51b221 Change the wording in a connection error message. I'm trying to make
Mark Doliner <mark@kingant.net>
parents: 26434
diff changeset
111 _("Unable to listen for incoming IM connections"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 /* Connect to the mDNS daemon looking for buddies in the LAN */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 bd->dns_sd_data = bonjour_dns_sd_new();
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
117 bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
118 bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 bd->dns_sd_data->port_p2pj = bd->jabber_data->port;
17739
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
120 /* Not engaged in AV conference */
c96b085ddf5c Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17733
diff changeset
121 bd->dns_sd_data->vc = g_strdup("!");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
123 status = purple_account_get_active_status(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
124 presence = purple_account_get_presence(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
125 if (purple_presence_is_available(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 bd->dns_sd_data->status = g_strdup("avail");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
127 else if (purple_presence_is_idle(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 bd->dns_sd_data->status = g_strdup("away");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 bd->dns_sd_data->status = g_strdup("dnd");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
131 bd->dns_sd_data->msg = g_strdup(purple_status_get_attr_string(status, "message"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 bd->dns_sd_data->account = account;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 if (!bonjour_dns_sd_start(bd->dns_sd_data))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
136 purple_connection_error_reason (gc,
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20892
diff changeset
137 PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20070
efadfc6e2117 Fix up Bonjour to use purple_connection_error_reason.
Will Thompson <will.thompson@collabora.co.uk>
parents: 19680
diff changeset
138 _("Unable to establish connection with the local mDNS server. Is it running?"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
142 bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
143
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
144 /* Show the buddy list by telling Purple we have already connected */
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
145 purple_connection_set_state(gc, PURPLE_CONNECTED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
149 bonjour_close(PurpleConnection *connection)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
151 PurpleGroup *bonjour_group;
17779
a62a695ccfb5 Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17739
diff changeset
152 BonjourData *bd = connection->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
154 bonjour_group = purple_find_group(BONJOUR_GROUP_NAME);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
155
21529
d3ac933fae46 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 <daniel.atallah@gmail.com>
parents: 21527
diff changeset
156 /* Remove all the bonjour buddies */
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
157 bonjour_removeallfromlocal(connection, bonjour_group);
21529
d3ac933fae46 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 <daniel.atallah@gmail.com>
parents: 21527
diff changeset
158
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 /* Stop looking for buddies in the LAN */
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
160 if (bd != NULL && bd->dns_sd_data != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 bonjour_dns_sd_stop(bd->dns_sd_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 bonjour_dns_sd_free(bd->dns_sd_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
20308
c2d3c9fc71b5 applied changes from fbb7ffaf4075cf690cc3ff9d171e56320e9af8da
Luke Schierer <lschiere@pidgin.im>
parents: 19680
diff changeset
166 if (bd != NULL && bd->jabber_data != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 /* Stop waiting for conversations */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 bonjour_jabber_stop(bd->jabber_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 g_free(bd->jabber_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 /* Delete the bonjour group */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 if (bonjour_group != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
175 purple_blist_remove_group(bonjour_group);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176
21522
dc703f13449a 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 <daniel.atallah@gmail.com>
parents: 21437
diff changeset
177 /* Cancel any file transfers */
dc703f13449a 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 <daniel.atallah@gmail.com>
parents: 21437
diff changeset
178 while (bd != NULL && bd->xfer_lists) {
dc703f13449a 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 <daniel.atallah@gmail.com>
parents: 21437
diff changeset
179 purple_xfer_cancel_local(bd->xfer_lists->data);
dc703f13449a 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 <daniel.atallah@gmail.com>
parents: 21437
diff changeset
180 }
dc703f13449a 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 <daniel.atallah@gmail.com>
parents: 21437
diff changeset
181
20329
24ce4fcce5b0 applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 20308
diff changeset
182 g_free(bd);
24ce4fcce5b0 applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 20308
diff changeset
183 connection->proto_data = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 static const char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
187 bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 return BONJOUR_ICON_NAME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 static int
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
193 bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 if(!to || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
202 bonjour_set_status(PurpleAccount *account, PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
204 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 BonjourData *bd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 gboolean disconnected;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
207 PurpleStatusType *type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 int primitive;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
209 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 const char *message, *bonjour_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 gchar *stripped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
213 gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 bd = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
215 disconnected = purple_account_is_disconnected(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
216 type = purple_status_get_type(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
217 primitive = purple_status_type_get_primitive(type);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
218 presence = purple_account_get_presence(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
220 message = purple_status_get_attr_string(status, "message");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 if (message == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 message = "";
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
223 stripped = purple_markup_strip_html(message);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 * The three possible status for Bonjour are
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 * -available ("avail")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 * -idle ("away")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 * -away ("dnd")
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 * Each of them can have an optional message.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
232 if (purple_presence_is_available(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 bonjour_status = "avail";
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
234 else if (purple_presence_is_idle(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 bonjour_status = "away";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 bonjour_status = "dnd";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 bonjour_dns_sd_send_status(bd->dns_sd_data, bonjour_status, stripped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 g_free(stripped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242
21654
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
243 /*
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
244 * The add_buddy callback removes the buddy from the local list.
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
245 * Bonjour manages buddies for you, and adding someone locally by
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
246 * hand is stupid. Perhaps we should change libpurple not to allow adding
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
247 * if there is no add_buddy callback.
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
248 */
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
249 static void
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
250 bonjour_fake_add_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) {
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
251 purple_debug_error("bonjour", "Buddy '%s' manually added; removing. "
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
252 "Bonjour buddies must be discovered and not manually added.\n",
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
253 purple_buddy_get_name(buddy));
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
254
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
255 /* I suppose we could alert the user here, but it seems unnecessary. */
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
256
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
257 /* If this causes problems, it can be moved to an idle callback */
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
258 purple_blist_remove_buddy(buddy);
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
259 }
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
260
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
261
19573
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18857
diff changeset
262 static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) {
25279
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
263 BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy);
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
264 if (bb) {
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
265 bonjour_buddy_delete(bb);
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
266 purple_buddy_set_protocol_data(buddy, NULL);
19573
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18857
diff changeset
267 }
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18857
diff changeset
268 }
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18857
diff changeset
269
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 static GList *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
271 bonjour_status_types(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 GList *status_types = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
274 PurpleStatusType *type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 g_return_val_if_fail(account != NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
278 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 BONJOUR_STATUS_ID_AVAILABLE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 "message", _("Message"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
282 purple_value_new(PURPLE_TYPE_STRING), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 status_types = g_list_append(status_types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
285 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 BONJOUR_STATUS_ID_AWAY,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 "message", _("Message"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
289 purple_value_new(PURPLE_TYPE_STRING), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 status_types = g_list_append(status_types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
292 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 BONJOUR_STATUS_ID_OFFLINE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 NULL, TRUE, TRUE, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 status_types = g_list_append(status_types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 return status_types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
301 bonjour_convo_closed(PurpleConnection *connection, const char *who)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
303 PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
17794
612dc5149964 Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17791
diff changeset
304 BonjourBuddy *bb;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305
25279
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
306 if (buddy == NULL || (bb = purple_buddy_get_protocol_data(buddy)) == NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 * This buddy is not in our buddy list, and therefore does not really
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 * exist, so we won't have any data about them.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314
17794
612dc5149964 Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17791
diff changeset
315 bonjour_jabber_close_conversation(bb->conversation);
612dc5149964 Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17791
diff changeset
316 bb->conversation = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
319 static
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
320 void bonjour_set_buddy_icon(PurpleConnection *conn, PurpleStoredImage *img)
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
321 {
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
322 BonjourData *bd = conn->proto_data;
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
323 bonjour_dns_sd_update_buddy_icon(bd->dns_sd_data);
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
324 }
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
325
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
326
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 static char *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
328 bonjour_status_text(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329 {
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
330 const PurplePresence *presence;
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
331 const PurpleStatus *status;
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
332 const char *message;
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
333 gchar *ret = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
335 presence = purple_buddy_get_presence(buddy);
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
336 status = purple_presence_get_active_status(presence);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
337
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
338 message = purple_status_get_attr_string(status, "message");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
340 if (message != NULL) {
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
341 ret = g_markup_escape_text(message, -1);
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
342 purple_util_chrreplace(ret, '\n', ' ');
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
343 }
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
344
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
345 return ret;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
349 bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
351 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
352 PurpleStatus *status;
25279
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
353 BonjourBuddy *bb = purple_buddy_get_protocol_data(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354 const char *status_description;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
355 const char *message;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
357 presence = purple_buddy_get_presence(buddy);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
358 status = purple_presence_get_active_status(presence);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
359 message = purple_status_get_attr_string(status, "message");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
361 if (purple_presence_is_available(presence))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
362 status_description = purple_status_get_name(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
363 else if (purple_presence_is_idle(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 status_description = _("Idle");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
366 status_description = purple_status_get_name(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
368 purple_notify_user_info_add_pair(user_info, _("Status"), status_description);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 if (message != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
370 purple_notify_user_info_add_pair(user_info, _("Message"), message);
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
371
21654
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
372 if (bb == NULL) {
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
373 purple_debug_error("bonjour", "Got tooltip request for a buddy without protocol data.\n");
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
374 return;
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
375 }
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
376
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
377 /* Only show first/last name if there is a nickname set (to avoid duplication) */
24654
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
378 if (bb->nick != NULL && *bb->nick != '\0') {
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
379 if (bb->first != NULL && *bb->first != '\0')
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
380 purple_notify_user_info_add_pair(user_info, _("First name"), bb->first);
24654
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
381 if (bb->last != NULL && *bb->last != '\0')
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
382 purple_notify_user_info_add_pair(user_info, _("Last name"), bb->last);
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
383 }
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
384
24654
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
385 if (bb->email != NULL && *bb->email != '\0')
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23172
diff changeset
386 purple_notify_user_info_add_pair(user_info, _("Email"), bb->email);
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
387
24654
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
388 if (bb->AIM != NULL && *bb->AIM != '\0')
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
389 purple_notify_user_info_add_pair(user_info, _("AIM Account"), bb->AIM);
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
390
24654
efe41c4e0df0 Fix Bonjour to better deal with buddy values set to the empty string.
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
391 if (bb->jid != NULL && *bb->jid != '\0')
18857
bc9b78ba996a Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18856
diff changeset
392 purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
395 static void
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
396 bonjour_group_buddy(PurpleConnection *connection, const char *who, const char *old_group, const char *new_group)
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
397 {
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
398 PurpleBlistNodeFlags oldflags;
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
399 PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
400
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
401 if (buddy == NULL)
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
402 return;
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
403
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
404 oldflags = purple_blist_node_get_flags((PurpleBlistNode *)buddy);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
405
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
406 /* If we're moving them out of the bonjour group, make them persistent */
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
407 if (strcmp(new_group, BONJOUR_GROUP_NAME) == 0)
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
408 purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags | PURPLE_BLIST_NODE_FLAG_NO_SAVE);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
409 else
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
410 purple_blist_node_set_flags((PurpleBlistNode *)buddy, oldflags ^ PURPLE_BLIST_NODE_FLAG_NO_SAVE);
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
411
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
412 }
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
413
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 static gboolean
23094
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
415 bonjour_can_receive_file(PurpleConnection *connection, const char *who)
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
416 {
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
417 PurpleBuddy *buddy = purple_find_buddy(connection->account, who);
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
418
25279
ac967ea95b05 Use purple_buddy_get_protocol_data() and purple_buddy_set_protocol_data()
Richard Laager <rlaager@wiktel.com>
parents: 24280
diff changeset
419 return (buddy != NULL && purple_buddy_get_protocol_data(buddy) != NULL);
23094
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
420 }
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
421
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
422 static gboolean
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
423 plugin_unload(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 {
17791
61005dea822b Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17779
diff changeset
425 /* These shouldn't happen here because they are allocated in _init() */
61005dea822b Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 17779
diff changeset
426
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 g_free(default_firstname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 g_free(default_lastname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 g_free(default_hostname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
434 static PurplePlugin *my_protocol = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
436 static PurplePluginProtocolInfo prpl_info =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 OPT_PROTO_NO_PASSWORD,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 NULL, /* user_splits */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 NULL, /* protocol_options */
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
441 {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 bonjour_list_icon, /* list_icon */
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
443 NULL, /* list_emblem */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 bonjour_status_text, /* status_text */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 bonjour_tooltip_text, /* tooltip_text */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 bonjour_status_types, /* status_types */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 NULL, /* blist_node_menu */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 NULL, /* chat_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 NULL, /* chat_info_defaults */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 bonjour_login, /* login */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 bonjour_close, /* close */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 bonjour_send_im, /* send_im */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 NULL, /* set_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 NULL, /* send_typing */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 NULL, /* get_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 bonjour_set_status, /* set_status */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 NULL, /* set_idle */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 NULL, /* change_passwd */
21654
32629dbb0bb9 Don't allow buddies to be manually added to Bonjour (remove the added buddy in the prpl add_buddy callback). Also, fix a crash when rendering the tooltip for one of these previously added buddies. Fixes #4045.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21529
diff changeset
459 bonjour_fake_add_buddy, /* add_buddy */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 NULL, /* add_buddies */
19573
affacee881e8 Fix a couple potential leaks and prevent the avahi record resolver from being freed multiple times.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18857
diff changeset
461 bonjour_remove_buddy, /* remove_buddy */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 NULL, /* remove_buddies */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
463 NULL, /* add_permit */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 NULL, /* add_deny */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 NULL, /* rem_permit */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 NULL, /* rem_deny */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 NULL, /* set_permit_deny */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 NULL, /* join_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 NULL, /* reject_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
470 NULL, /* get_chat_name */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 NULL, /* chat_invite */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 NULL, /* chat_leave */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 NULL, /* chat_whisper */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474 NULL, /* chat_send */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 NULL, /* keepalive */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 NULL, /* register_user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 NULL, /* get_cb_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478 NULL, /* get_cb_away */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 NULL, /* alias_buddy */
22977
d50194ab3016 Bonjour buddies will be saved persistently if they're moved out of the
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22909
diff changeset
480 bonjour_group_buddy, /* group_buddy */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 NULL, /* rename_group */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 NULL, /* buddy_free */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 bonjour_convo_closed, /* convo_closed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 NULL, /* normalize */
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
485 bonjour_set_buddy_icon, /* set_buddy_icon */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 NULL, /* remove_group */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487 NULL, /* get_cb_real_name */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 NULL, /* set_chat_topic */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 NULL, /* find_blist_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490 NULL, /* roomlist_get_list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491 NULL, /* roomlist_cancel */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 NULL, /* roomlist_expand_category */
23094
2a81912c229a Some fixes from Eion Robb and me to prevent bonjour crashes with the newly
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23011
diff changeset
493 bonjour_can_receive_file, /* can_receive_file */
21437
db7fa42845f6 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 <daniel.atallah@gmail.com>
parents: 21418
diff changeset
494 bonjour_send_file, /* send_file */
db7fa42845f6 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 <daniel.atallah@gmail.com>
parents: 21418
diff changeset
495 bonjour_new_xfer, /* new_xfer */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 NULL, /* offline_message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 NULL, /* whiteboard_prpl_ops */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 NULL, /* send_raw */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499 NULL, /* roomlist_room_serialize */
25560
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25557
diff changeset
500 NULL, /* unregister_user */
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25557
diff changeset
501 NULL, /* send_attention */
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25557
diff changeset
502 NULL, /* get_attention_types */
750d700098c1 Fix the prplinfo structs and get rid of some compile warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25557
diff changeset
503 sizeof(PurplePluginProtocolInfo), /* struct_size */
25657
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
504 NULL, /* get_account_text_table */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23182 25637
diff changeset
505 NULL, /* initiate_media */
25637
92e71f6e10d4 Patch from Marcus Lundblad ('mlundblad') to improve audio support in xmpp.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 25632
diff changeset
506 NULL /* can_do_media */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
509 static PurplePluginInfo info =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
511 PURPLE_PLUGIN_MAGIC,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
512 PURPLE_MAJOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
513 PURPLE_MINOR_VERSION,
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
514 PURPLE_PLUGIN_PROTOCOL, /**< type */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
515 NULL, /**< ui_requirement */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
516 0, /**< flags */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
517 NULL, /**< dependencies */
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
518 PURPLE_PRIORITY_DEFAULT, /**< priority */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
519
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
520 "prpl-bonjour", /**< id */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
521 "Bonjour", /**< name */
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 20329
diff changeset
522 DISPLAY_VERSION, /**< version */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
523 /** summary */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
524 N_("Bonjour Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
525 /** description */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
526 N_("Bonjour Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
527 NULL, /**< author */
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
528 PURPLE_WEBSITE, /**< homepage */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
529
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
530 NULL, /**< load */
18856
5da32c4019ce Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18843
diff changeset
531 plugin_unload, /**< unload */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 NULL, /**< destroy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
534 NULL, /**< ui_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 &prpl_info, /**< extra_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
536 NULL, /**< prefs_info */
16711
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
537 NULL,
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
538
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
539 /* padding */
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
540 NULL,
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
541 NULL,
56f0049d3207 Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents: 15935
diff changeset
542 NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
543 NULL
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
545
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
546 #ifdef WIN32
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
547 static gboolean _set_default_name_cb(gpointer data) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
548 gchar *fullname = data;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
549 const char *splitpoint;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
550 GList *tmp = prpl_info.protocol_options;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
551 PurpleAccountOption *option;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
553 if (!fullname) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
554 purple_debug_info("bonjour", "Unable to look up First and Last name or Username from system; using defaults.\n");
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
555 return FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
558 g_free(default_firstname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
559 g_free(default_lastname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
560
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
561 /* Split the real name into a first and last name */
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
562 splitpoint = strchr(fullname, ' ');
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
563 if (splitpoint != NULL) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
564 default_firstname = g_strndup(fullname, splitpoint - fullname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
565 default_lastname = g_strdup(&splitpoint[1]);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
566 } else {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
567 default_firstname = g_strdup(fullname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
568 default_lastname = g_strdup("");
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
569 }
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
570 g_free(fullname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
571
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
572
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
573 for(; tmp != NULL; tmp = tmp->next) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
574 option = tmp->data;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
575 if (strcmp("first", purple_account_option_get_setting(option)) == 0)
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
576 purple_account_option_set_default_string(option, default_firstname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
577 else if (strcmp("last", purple_account_option_get_setting(option)) == 0)
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
578 purple_account_option_set_default_string(option, default_lastname);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
579 }
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
580
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
581 return FALSE;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
582 }
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
583
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
584 static gpointer _win32_name_lookup_thread(gpointer data) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
585 gchar *fullname = NULL;
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
586 wchar_t username[UNLEN + 1];
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
587 DWORD dwLenUsername = UNLEN + 1;
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
588
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
589 GetUserNameW((LPWSTR) &username, &dwLenUsername);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
591 if (username != NULL && *username != '\0') {
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
592 LPBYTE servername = NULL;
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
593 LPBYTE info = NULL;
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
594
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
595 NetGetDCName(NULL, NULL, &servername);
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
596
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
597 /* purple_debug_info("bonjour", "Looking up the full name from the %s.\n", (servername ? "domain controller" : "local machine")); */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
599 if (NetUserGetInfo((LPCWSTR) servername, username, 10, &info) == NERR_Success
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
600 && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
601 && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') {
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
602 fullname = g_utf16_to_utf8(
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
603 ((LPUSER_INFO_10) info)->usri10_full_name,
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
604 -1, NULL, NULL, NULL);
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
605 }
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
606 /* Fall back to the local machine if we didn't get the full name from the domain controller */
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
607 else if (servername != NULL) {
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
608 /* purple_debug_info("bonjour", "Looking up the full name from the local machine"); */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
610 if (info != NULL) NetApiBufferFree(info);
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
611 info = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
613 if (NetUserGetInfo(NULL, username, 10, &info) == NERR_Success
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
614 && info != NULL && ((LPUSER_INFO_10) info)->usri10_full_name != NULL
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
615 && *(((LPUSER_INFO_10) info)->usri10_full_name) != '\0') {
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
616 fullname = g_utf16_to_utf8(
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
617 ((LPUSER_INFO_10) info)->usri10_full_name,
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
618 -1, NULL, NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
622 if (info != NULL) NetApiBufferFree(info);
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
623 if (servername != NULL) NetApiBufferFree(servername);
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
624
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
625 if (!fullname)
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
626 fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628
20329
24ce4fcce5b0 applied changes from e56db1b8a7bb8729e30fb3bf99a94ff7887fe4ec
Luke Schierer <lschiere@pidgin.im>
parents: 20308
diff changeset
629 purple_timeout_add(0, _set_default_name_cb, fullname);
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
630
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
631 return NULL;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
632 }
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
633 #endif
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
634
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
635 static void
22007
c38d72677c8a Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@wiktel.com>
parents: 21829
diff changeset
636 initialize_default_account_values(void)
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
637 {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
638 #ifndef _WIN32
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
639 struct passwd *info;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
640 #endif
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
641 const char *fullname = NULL, *splitpoint, *tmp;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
642 gchar *conv = NULL;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
643
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
644 #ifndef _WIN32
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
645 /* Try to figure out the user's real name */
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
646 info = getpwuid(getuid());
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
647 if ((info != NULL) && (info->pw_gecos != NULL) && (info->pw_gecos[0] != '\0'))
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
648 fullname = info->pw_gecos;
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
649 else if ((info != NULL) && (info->pw_name != NULL) && (info->pw_name[0] != '\0'))
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
650 fullname = info->pw_name;
19663
ccf627e2e0cc We have got an empty fullname, set it to NULL so that we fall back to
Mark Doliner <mark@kingant.net>
parents: 19645
diff changeset
651 else if (((fullname = getlogin()) != NULL) && (fullname[0] == '\0'))
ccf627e2e0cc We have got an empty fullname, set it to NULL so that we fall back to
Mark Doliner <mark@kingant.net>
parents: 19645
diff changeset
652 fullname = NULL;
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
653 #else
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
654 /* The Win32 username lookup functions are synchronous so we do it in a thread */
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
655 g_thread_create(_win32_name_lookup_thread, NULL, FALSE, NULL);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
656 #endif
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
657
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
658 /* Make sure fullname is valid UTF-8. If not, try to convert it. */
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
659 if (fullname != NULL && !g_utf8_validate(fullname, -1, NULL)) {
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
660 fullname = conv = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL);
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
661 if (conv == NULL || *conv == '\0')
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
662 fullname = NULL;
18578
acd4ff9ddace 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 <daniel.atallah@gmail.com>
parents: 17794
diff changeset
663 }
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
664
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
665 if (fullname == NULL)
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
666 fullname = _("Purple Person");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 /* Split the real name into a first and last name */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
669 splitpoint = strchr(fullname, ' ');
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
670 if (splitpoint != NULL) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 default_firstname = g_strndup(fullname, splitpoint - fullname);
16789
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
672 tmp = &splitpoint[1];
18843
7bf6b9a70b41 Some more minor mdns implementation abstraction tweaks and implementation of setting buddy icons for the win32 bonjour implementation.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18578
diff changeset
673
16789
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
674 /* The last name may be followed by a comma and additional data.
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
675 * Only use the last name itself.
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
676 */
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
677 splitpoint = strchr(tmp, ',');
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
678 if (splitpoint != NULL)
17733
d7b50cac1c7a 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 <daniel.atallah@gmail.com>
parents: 16915
diff changeset
679 default_lastname = g_strndup(tmp, splitpoint - tmp);
16789
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
680 else
a9975d6c2832 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 <evan.s@dreskin.net>
parents: 16728
diff changeset
681 default_lastname = g_strdup(tmp);
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
682 } else {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 default_firstname = g_strdup(fullname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684 default_lastname = g_strdup("");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686
19645
55d3f1622cf7 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 <daniel.atallah@gmail.com>
parents: 19573
diff changeset
687 g_free(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 /* Try to figure out a good host name to use */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 /* TODO: Avoid 'localhost,' if possible */
23583
399975ad001c Add purple_get_host_name to get the hostname of the machine.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23391
diff changeset
691 default_hostname = g_strdup(purple_get_host_name());
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
695 init_plugin(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
697 PurpleAccountUserSplit *split;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
698 PurpleAccountOption *option;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 initialize_default_account_values();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 /* Creating the user splits */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
703 split = purple_account_user_split_new(_("Hostname"), default_hostname, '@');
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 /* Creating the options for the protocol */
25131
f38799160cfa Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24654
diff changeset
707 option = purple_account_option_int_new(_("Local Port"), "port", BONJOUR_DEFAULT_PORT);
f38799160cfa Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24654
diff changeset
708 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
f38799160cfa Better support running many Bonjour clients on the same machine by allowing a
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24654
diff changeset
709
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
710 option = purple_account_option_string_new(_("First name"), "first", default_firstname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
713 option = purple_account_option_string_new(_("Last name"), "last", default_lastname);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
23182
e0bcb8cfda74 Use "email" and "Email" consistently. This is potentially controversial,
Richard Laager <rlaager@wiktel.com>
parents: 23172
diff changeset
716 option = purple_account_option_string_new(_("Email"), "email", "");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
719 option = purple_account_option_string_new(_("AIM Account"), "AIM", "");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721
16915
56042b2f8b64 s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents: 16789
diff changeset
722 option = purple_account_option_string_new(_("XMPP Account"), "jid", "");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 my_protocol = plugin;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15811
diff changeset
728 PURPLE_INIT_PLUGIN(bonjour, init_plugin, info);