Mercurial > pidgin
annotate libpurple/protocols/bonjour/bonjour.c @ 20037:ba649e93098b
it seems that "SOURCES" is a reserved variable in some versions of automake,
which was causing this to break the build badly for me
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Fri, 14 Sep 2007 15:38:40 +0000 |
parents | 44b4e8bd759b |
children | efadfc6e2117 c2d3c9fc71b5 |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15822 | 2 * purple - Bonjour Protocol Plugin |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * Purple is the legal property of its developers, whose names are too numerous |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
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 |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19664
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include <windows.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include <lm.h> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "internal.h" |
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 "account.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "accountopt.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "util.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "version.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "bonjour.h" |
17495
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:
16904
diff
changeset
|
40 #include "mdns_common.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "jabber.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
42 #include "buddy.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 * TODO: Should implement an add_buddy callback that removes the buddy |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 * from the local list. Bonjour manages buddies for you, and |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 * adding someone locally by hand is stupid. Or, maybe even better, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 * if a PRPL does not have an add_buddy callback then do not allow |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 * users to add buddies. |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
52 static char *default_firstname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 static char *default_lastname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 static char *default_hostname; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 static void |
15822 | 57 bonjour_removeallfromlocal(PurpleConnection *gc) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 { |
15822 | 59 PurpleAccount *account = purple_connection_get_account(gc); |
60 PurpleBuddyList *blist; | |
15920
d7feace39800
Fix some reads of invalid memory when shutting down bonjour when there
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
61 PurpleBlistNode *gnode, *cnode, *cnodenext, *bnode, *bnodenext; |
15822 | 62 PurpleBuddy *buddy; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 |
15822 | 64 blist = purple_get_blist(); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 if (blist == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 /* Go through and remove all buddies that belong to this account */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 for (gnode = blist->root; gnode; gnode = gnode->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 { |
15822 | 71 if (!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 continue; |
15920
d7feace39800
Fix some reads of invalid memory when shutting down bonjour when there
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
73 for (cnode = gnode->child; cnode; cnode = cnodenext) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 { |
15920
d7feace39800
Fix some reads of invalid memory when shutting down bonjour when there
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
75 cnodenext = cnode->next; |
15822 | 76 if (!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
77 continue; |
15920
d7feace39800
Fix some reads of invalid memory when shutting down bonjour when there
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
78 for (bnode = cnode->child; bnode; bnode = bnodenext) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 { |
15920
d7feace39800
Fix some reads of invalid memory when shutting down bonjour when there
Mark Doliner <mark@kingant.net>
parents:
15822
diff
changeset
|
80 bnodenext = bnode->next; |
15822 | 81 if (!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 continue; |
15822 | 83 buddy = (PurpleBuddy *)bnode; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 if (buddy->account != account) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 continue; |
15822 | 86 purple_prpl_got_user_status(account, buddy->name, "offline", NULL); |
87 purple_blist_remove_buddy(buddy); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 static void |
15822 | 94 bonjour_login(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 { |
15822 | 96 PurpleConnection *gc = purple_account_get_connection(account); |
17541
a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17501
diff
changeset
|
97 PurpleGroup *bonjour_group; |
a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17501
diff
changeset
|
98 BonjourData *bd; |
15822 | 99 PurpleStatus *status; |
100 PurplePresence *presence; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
15822 | 102 gc->flags |= PURPLE_CONNECTION_HTML; |
17541
a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17501
diff
changeset
|
103 gc->proto_data = bd = g_new0(BonjourData, 1); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 /* Start waiting for jabber connections (iChat style) */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 bd->jabber_data = g_new(BonjourJabber, 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 bd->jabber_data->port = BONJOUR_DEFAULT_PORT_INT; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 bd->jabber_data->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 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
|
111 /* Send a message about the connection error */ |
15822 | 112 purple_connection_error(gc, _("Unable to listen for incoming IM connections\n")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 return; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 /* 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
|
117 bd->dns_sd_data = bonjour_dns_sd_new(); |
15822 | 118 bd->dns_sd_data->first = g_strdup(purple_account_get_string(account, "first", default_firstname)); |
119 bd->dns_sd_data->last = g_strdup(purple_account_get_string(account, "last", default_lastname)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 bd->dns_sd_data->port_p2pj = bd->jabber_data->port; |
17501
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
121 /* Not engaged in AV conference */ |
c96b085ddf5c
Clean up Bonjour service publishing and improve XEP-0174 compliance.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17495
diff
changeset
|
122 bd->dns_sd_data->vc = g_strdup("!"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
15822 | 124 status = purple_account_get_active_status(account); |
125 presence = purple_account_get_presence(account); | |
126 if (purple_presence_is_available(presence)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 bd->dns_sd_data->status = g_strdup("avail"); |
15822 | 128 else if (purple_presence_is_idle(presence)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 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
|
130 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 bd->dns_sd_data->status = g_strdup("dnd"); |
15822 | 132 bd->dns_sd_data->msg = g_strdup(purple_status_get_attr_string(status, "message")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 bd->dns_sd_data->account = account; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 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
|
136 { |
15822 | 137 purple_connection_error(gc, _("Unable to establish connection with the local mDNS server. Is it running?")); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 |
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
|
141 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
|
142 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 /* Create a group for bonjour buddies */ |
15822 | 144 bonjour_group = purple_group_new(BONJOUR_GROUP_NAME); |
145 purple_blist_add_group(bonjour_group, NULL); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
15822 | 147 /* Show the buddy list by telling Purple we have already connected */ |
148 purple_connection_set_state(gc, PURPLE_CONNECTED); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 static void |
15822 | 152 bonjour_close(PurpleConnection *connection) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 { |
15822 | 154 PurpleGroup *bonjour_group; |
17541
a62a695ccfb5
Improve Bonjour error handling when there are errors "connecting".
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17501
diff
changeset
|
155 BonjourData *bd = connection->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 /* Stop looking for buddies in the LAN */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 if (bd->dns_sd_data != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 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
|
161 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
|
162 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 if (bd->jabber_data != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 /* Stop waiting for conversations */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 bonjour_jabber_stop(bd->jabber_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 g_free(bd->jabber_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
171 /* Remove all the bonjour buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
172 bonjour_removeallfromlocal(connection); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
173 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
174 /* Delete the bonjour group */ |
15822 | 175 bonjour_group = purple_find_group(BONJOUR_GROUP_NAME); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 if (bonjour_group != NULL) |
15822 | 177 purple_blist_remove_group(bonjour_group); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
179 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
180 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 static const char * |
15822 | 182 bonjour_list_icon(PurpleAccount *account, PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 return BONJOUR_ICON_NAME; |
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 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 static int |
15822 | 188 bonjour_send_im(PurpleConnection *connection, const char *to, const char *msg, PurpleMessageFlags flags) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
189 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
190 if(!to || !msg) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 return 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
192 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
193 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
|
194 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
196 static void |
15822 | 197 bonjour_set_status(PurpleAccount *account, PurpleStatus *status) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
198 { |
15822 | 199 PurpleConnection *gc; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 BonjourData *bd; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
201 gboolean disconnected; |
15822 | 202 PurpleStatusType *type; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 int primitive; |
15822 | 204 PurplePresence *presence; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 const char *message, *bonjour_status; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 gchar *stripped; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 |
15822 | 208 gc = purple_account_get_connection(account); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 bd = gc->proto_data; |
15822 | 210 disconnected = purple_account_is_disconnected(account); |
211 type = purple_status_get_type(status); | |
212 primitive = purple_status_type_get_primitive(type); | |
213 presence = purple_account_get_presence(account); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 |
15822 | 215 message = purple_status_get_attr_string(status, "message"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 if (message == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 message = ""; |
15822 | 218 stripped = purple_markup_strip_html(message); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 * The three possible status for Bonjour are |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 * -available ("avail") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 * -idle ("away") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 * -away ("dnd") |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 * 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
|
226 */ |
15822 | 227 if (purple_presence_is_available(presence)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 bonjour_status = "avail"; |
15822 | 229 else if (purple_presence_is_idle(presence)) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 bonjour_status = "away"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 bonjour_status = "dnd"; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 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
|
235 g_free(stripped); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 |
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
|
238 static void bonjour_remove_buddy(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group) { |
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
|
239 if (buddy->proto_data) { |
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
|
240 bonjour_buddy_delete(buddy->proto_data); |
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
|
241 buddy->proto_data = NULL; |
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
|
242 } |
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
|
243 } |
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
|
244 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 static GList * |
15822 | 246 bonjour_status_types(PurpleAccount *account) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 GList *status_types = NULL; |
15822 | 249 PurpleStatusType *type; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 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
|
252 |
15822 | 253 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 BONJOUR_STATUS_ID_AVAILABLE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 "message", _("Message"), |
15822 | 257 purple_value_new(PURPLE_TYPE_STRING), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 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
|
259 |
15822 | 260 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 BONJOUR_STATUS_ID_AWAY, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 NULL, TRUE, TRUE, FALSE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 "message", _("Message"), |
15822 | 264 purple_value_new(PURPLE_TYPE_STRING), NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 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
|
266 |
15822 | 267 type = purple_status_type_new_full(PURPLE_STATUS_OFFLINE, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 BONJOUR_STATUS_ID_OFFLINE, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 NULL, TRUE, TRUE, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 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
|
271 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 return status_types; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
275 static void |
15822 | 276 bonjour_convo_closed(PurpleConnection *connection, const char *who) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 { |
15822 | 278 PurpleBuddy *buddy = purple_find_buddy(connection->account, who); |
17556
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
279 BonjourBuddy *bb; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 if (buddy == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 /* |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 * 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
|
285 * 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
|
286 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 |
17556
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
290 bb = buddy->proto_data; |
612dc5149964
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17553
diff
changeset
|
291 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:
17553
diff
changeset
|
292 bb->conversation = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
293 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 |
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
|
295 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
|
296 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
|
297 { |
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
|
298 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
|
299 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
|
300 } |
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
|
301 |
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
|
302 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 static char * |
15822 | 304 bonjour_status_text(PurpleBuddy *buddy) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 { |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
306 const PurplePresence *presence; |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
307 const PurpleStatus *status; |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
308 const char *message; |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
309 gchar *ret = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 |
15822 | 311 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
|
312 status = purple_presence_get_active_status(presence); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
313 |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
314 message = purple_status_get_attr_string(status, "message"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
316 if (message != NULL) { |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
317 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
|
318 purple_util_chrreplace(ret, '\n', ' '); |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
319 } |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
320 |
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
321 return ret; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 static void |
15822 | 325 bonjour_tooltip_text(PurpleBuddy *buddy, PurpleNotifyUserInfo *user_info, gboolean full) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 { |
15822 | 327 PurplePresence *presence; |
328 PurpleStatus *status; | |
18857
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
329 BonjourBuddy *bb = buddy->proto_data; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 const char *status_description; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 const char *message; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 |
15822 | 333 presence = purple_buddy_get_presence(buddy); |
334 status = purple_presence_get_active_status(presence); | |
335 message = purple_status_get_attr_string(status, "message"); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 |
15822 | 337 if (purple_presence_is_available(presence)) |
338 status_description = purple_status_get_name(status); | |
339 else if (purple_presence_is_idle(presence)) | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
340 status_description = _("Idle"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 else |
15822 | 342 status_description = purple_status_get_name(status); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
343 |
15822 | 344 purple_notify_user_info_add_pair(user_info, _("Status"), status_description); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 if (message != NULL) |
15822 | 346 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
|
347 |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
348 /* Only show first/last name if there is a nickname set (to avoid duplication) */ |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
349 if (bb->nick != NULL) { |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
350 if (bb->first != NULL) |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
351 purple_notify_user_info_add_pair(user_info, _("First name"), bb->first); |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
352 if (bb->first != NULL) |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
353 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
|
354 } |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
355 |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
356 if (bb->email != NULL) |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
357 purple_notify_user_info_add_pair(user_info, _("E-Mail"), bb->email); |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
358 |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
359 if (bb->AIM != NULL) |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
360 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
|
361 |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
362 if (bb->jid!= NULL) |
bc9b78ba996a
Add data to the bonjour tooltip.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18856
diff
changeset
|
363 purple_notify_user_info_add_pair(user_info, _("XMPP Account"), bb->jid); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
364 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
365 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
366 static gboolean |
15822 | 367 plugin_unload(PurplePlugin *plugin) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
368 { |
17553
61005dea822b
Cleanup, fix a leak and prevent the inbound xml from being parsed twice for every message.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
17541
diff
changeset
|
369 /* 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:
17541
diff
changeset
|
370 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 g_free(default_firstname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 g_free(default_lastname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 g_free(default_hostname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
375 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
376 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 |
15822 | 378 static PurplePlugin *my_protocol = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
15822 | 380 static PurplePluginProtocolInfo prpl_info = |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
381 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 OPT_PROTO_NO_PASSWORD, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 NULL, /* user_splits */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 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
|
385 {"png,gif,jpeg", 0, 0, 96, 96, 65535, PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 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
|
387 NULL, /* list_emblem */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
388 bonjour_status_text, /* status_text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 bonjour_tooltip_text, /* tooltip_text */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 bonjour_status_types, /* status_types */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 NULL, /* blist_node_menu */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 NULL, /* chat_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 NULL, /* chat_info_defaults */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 bonjour_login, /* login */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
395 bonjour_close, /* close */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 bonjour_send_im, /* send_im */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 NULL, /* set_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
398 NULL, /* send_typing */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 NULL, /* get_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
400 bonjour_set_status, /* set_status */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 NULL, /* set_idle */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 NULL, /* change_passwd */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 NULL, /* add_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
404 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
|
405 bonjour_remove_buddy, /* remove_buddy */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 NULL, /* remove_buddies */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 NULL, /* add_permit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 NULL, /* add_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 NULL, /* rem_permit */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
410 NULL, /* rem_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 NULL, /* set_permit_deny */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 NULL, /* join_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 NULL, /* reject_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 NULL, /* get_chat_name */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 NULL, /* chat_invite */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 NULL, /* chat_leave */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 NULL, /* chat_whisper */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
418 NULL, /* chat_send */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 NULL, /* keepalive */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 NULL, /* register_user */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 NULL, /* get_cb_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 NULL, /* get_cb_away */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 NULL, /* alias_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 NULL, /* group_buddy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 NULL, /* rename_group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 NULL, /* buddy_free */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 bonjour_convo_closed, /* convo_closed */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 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
|
429 bonjour_set_buddy_icon, /* set_buddy_icon */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 NULL, /* remove_group */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 NULL, /* get_cb_real_name */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 NULL, /* set_chat_topic */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 NULL, /* find_blist_chat */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 NULL, /* roomlist_get_list */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 NULL, /* roomlist_cancel */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 NULL, /* roomlist_expand_category */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 NULL, /* can_receive_file */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
438 NULL, /* send_file */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
439 NULL, /* new_xfer */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
440 NULL, /* offline_message */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 NULL, /* whiteboard_prpl_ops */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
442 NULL, /* send_raw */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
443 NULL, /* roomlist_room_serialize */ |
16702
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
444 |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
445 /* padding */ |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
446 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
447 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
448 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
449 NULL |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
450 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
451 |
15822 | 452 static PurplePluginInfo info = |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 { |
15822 | 454 PURPLE_PLUGIN_MAGIC, |
455 PURPLE_MAJOR_VERSION, | |
456 PURPLE_MINOR_VERSION, | |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
457 PURPLE_PLUGIN_PROTOCOL, /**< type */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 NULL, /**< ui_requirement */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
459 0, /**< flags */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
460 NULL, /**< dependencies */ |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
461 PURPLE_PRIORITY_DEFAULT, /**< priority */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
462 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
463 "prpl-bonjour", /**< id */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 "Bonjour", /**< name */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 VERSION, /**< version */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 /** summary */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 N_("Bonjour Protocol Plugin"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
468 /** description */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 N_("Bonjour Protocol Plugin"), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
470 NULL, /**< author */ |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
471 PURPLE_WEBSITE, /**< homepage */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 NULL, /**< load */ |
18856
5da32c4019ce
Show bonjour status messages in the buddy list.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
18843
diff
changeset
|
474 plugin_unload, /**< unload */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 NULL, /**< destroy */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
476 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
477 NULL, /**< ui_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
478 &prpl_info, /**< extra_info */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
479 NULL, /**< prefs_info */ |
16702
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
480 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
481 |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
482 /* padding */ |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
483 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
484 NULL, |
56f0049d3207
Add padding to silc and bonjour to get rid of a bunch of warnings.
Mark Doliner <mark@kingant.net>
parents:
15932
diff
changeset
|
485 NULL, |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
486 NULL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
487 }; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
488 |
19646
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
|
489 #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
|
490 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
|
491 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
|
492 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
|
493 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
|
494 PurpleAccountOption *option; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
495 |
19646
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
|
496 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
|
497 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
|
498 return FALSE; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
499 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
500 |
19646
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
|
501 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
|
502 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
|
503 |
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
|
504 /* 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
|
505 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
|
506 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
|
507 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
|
508 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
|
509 } 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
|
510 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
|
511 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
|
512 } |
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
|
513 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
|
514 |
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
|
515 |
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
|
516 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
|
517 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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 } |
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
|
523 |
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
|
524 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
|
525 } |
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
|
526 |
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
|
527 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
|
528 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:
17556
diff
changeset
|
529 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:
17556
diff
changeset
|
530 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:
17556
diff
changeset
|
531 |
19646
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
|
532 GetUserNameW((LPWSTR) &username, &dwLenUsername); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
533 |
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:
17556
diff
changeset
|
534 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:
17556
diff
changeset
|
535 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:
17556
diff
changeset
|
536 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:
17556
diff
changeset
|
537 |
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:
17556
diff
changeset
|
538 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:
17556
diff
changeset
|
539 |
19646
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
|
540 /* purple_debug_info("bonjour", "Looking up the full name from the %s.\n", (servername ? "domain controller" : "local machine")); */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
541 |
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:
17556
diff
changeset
|
542 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:
17556
diff
changeset
|
543 && 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:
17556
diff
changeset
|
544 && *(((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:
17556
diff
changeset
|
545 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:
17556
diff
changeset
|
546 ((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:
17556
diff
changeset
|
547 -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:
17556
diff
changeset
|
548 } |
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:
17556
diff
changeset
|
549 /* 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:
17556
diff
changeset
|
550 else if (servername != NULL) { |
19646
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 /* purple_debug_info("bonjour", "Looking up the full name from the local machine"); */ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
552 |
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:
17556
diff
changeset
|
553 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:
17556
diff
changeset
|
554 info = NULL; |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
555 |
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:
17556
diff
changeset
|
556 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:
17556
diff
changeset
|
557 && 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:
17556
diff
changeset
|
558 && *(((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:
17556
diff
changeset
|
559 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:
17556
diff
changeset
|
560 ((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:
17556
diff
changeset
|
561 -1, NULL, NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 |
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:
17556
diff
changeset
|
565 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:
17556
diff
changeset
|
566 if (servername != NULL) NetApiBufferFree(servername); |
19646
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 |
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 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
|
569 fullname = g_utf16_to_utf8(username, -1, NULL, NULL, NULL); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 |
19646
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 g_idle_add(_set_default_name_cb, 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
|
573 |
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 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
|
575 } |
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 #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
|
577 |
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 static void |
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 initialize_default_account_values() |
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 #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
|
582 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
|
583 #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
|
584 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
|
585 char hostname[255]; |
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
|
586 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
|
587 |
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
|
588 #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
|
589 /* 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
|
590 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
|
591 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
|
592 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
|
593 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
|
594 fullname = info->pw_name; |
19664
ccf627e2e0cc
We have got an empty fullname, set it to NULL so that we fall back to
Mark Doliner <mark@kingant.net>
parents:
19646
diff
changeset
|
595 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:
19646
diff
changeset
|
596 fullname = NULL; |
19646
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 #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
|
598 /* 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
|
599 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
|
600 #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
|
601 |
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
|
602 /* 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
|
603 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
|
604 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
|
605 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
|
606 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:
17556
diff
changeset
|
607 } |
19646
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 |
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
|
609 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
|
610 fullname = _("Purple Person"); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
611 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 /* 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
|
613 splitpoint = strchr(fullname, ' '); |
19646
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
|
614 if (splitpoint != NULL) { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 default_firstname = g_strndup(fullname, splitpoint - fullname); |
16778
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:
16719
diff
changeset
|
616 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
|
617 |
16778
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:
16719
diff
changeset
|
618 /* 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:
16719
diff
changeset
|
619 * 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:
16719
diff
changeset
|
620 */ |
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:
16719
diff
changeset
|
621 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:
16719
diff
changeset
|
622 if (splitpoint != NULL) |
17495
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:
16904
diff
changeset
|
623 default_lastname = g_strndup(tmp, splitpoint - tmp); |
16778
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:
16719
diff
changeset
|
624 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:
16719
diff
changeset
|
625 default_lastname = g_strdup(tmp); |
19646
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 } else { |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 default_firstname = g_strdup(fullname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 default_lastname = g_strdup(""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 |
19646
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 g_free(conv); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 /* 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
|
634 /* TODO: Avoid 'localhost,' if possible */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 if (gethostname(hostname, 255) != 0) { |
15932 | 636 purple_debug_warning("bonjour", "Error when getting host name: %s. Using \"localhost.\"\n", |
637 strerror(errno)); | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 strcpy(hostname, "localhost"); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 default_hostname = g_strdup(hostname); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
642 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
643 static void |
15822 | 644 init_plugin(PurplePlugin *plugin) |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
645 { |
15822 | 646 PurpleAccountUserSplit *split; |
647 PurpleAccountOption *option; | |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
648 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
649 initialize_default_account_values(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 /* Creating the user splits */ |
15822 | 652 split = purple_account_user_split_new(_("Hostname"), default_hostname, '@'); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
653 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
|
654 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 /* Creating the options for the protocol */ |
15822 | 656 option = purple_account_option_string_new(_("First name"), "first", default_firstname); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 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
|
658 |
15822 | 659 option = purple_account_option_string_new(_("Last name"), "last", default_lastname); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
660 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
|
661 |
15822 | 662 option = purple_account_option_string_new(_("E-mail"), "email", ""); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 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
|
664 |
15822 | 665 option = purple_account_option_string_new(_("AIM Account"), "AIM", ""); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 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
|
667 |
16904
56042b2f8b64
s/Jabber/XMPP in user-visible places.
Richard Laager <rlaager@wiktel.com>
parents:
16778
diff
changeset
|
668 option = purple_account_option_string_new(_("XMPP Account"), "jid", ""); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 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
|
670 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 my_protocol = plugin; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
673 |
15822 | 674 PURPLE_INIT_PLUGIN(bonjour, init_plugin, info); |