annotate src/protocols/bonjour/bonjour.c @ 13549:cef825f41d56

[gaim-migrate @ 15926] Kevin suggested this on gaim-devel: 'I would suggest changing "_Only when someone says your nick" in the message notification plugin to a more standard terminology for your own name or screen name or nickname. "Nick" is an IRC abbreviation which may be less clear. Kevin' committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Wed, 22 Mar 2006 06:56:41 +0000
parents cfc2f7fcb3dd
children b986b6e2441b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
1 /*
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
2 * gaim - Bonjour Protocol Plugin
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
3 *
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
6 * source distribution.
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
7 *
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
11 * (at your option) any later version.
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
12 *
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
16 * GNU General Public License for more details.
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
17 *
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
21 */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
22 #include <glib.h>
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
23 #ifndef _WIN32
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
24 #include <pwd.h>
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
25 #else
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
26 #define UNICODE
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
27 #include <windows.h>
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
28 #include <lm.h>
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
29 #endif
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
30
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
31 #include "internal.h"
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
32
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
33 #include "account.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
34 #include "accountopt.h"
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
35 #include "debug.h"
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
36 #include "util.h"
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
37 #include "version.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
38
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
39 #include "bonjour.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
40 #include "dns_sd.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
41 #include "jabber.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
42 #include "buddy.h"
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
43
12339
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
44 /*
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
45 * TODO: Should implement an add_buddy callback that removes the buddy
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
46 * from the local list. Bonjour manages buddies for you, and
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
47 * adding someone locally by hand is stupid. Or, maybe even better,
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
48 * if a PRPL does not have an add_buddy callback then do not allow
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
49 * users to add buddies.
12339
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
50 */
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
51
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
52 static char *default_firstname;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
53 static char *default_lastname;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
54 static char *default_hostname;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
55
11691
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
56 static void
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
57 bonjour_removeallfromlocal(GaimConnection *gc)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
58 {
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
59 GaimAccount *account = gaim_connection_get_account(gc);
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
60 GaimBuddyList *blist;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
61 GaimBlistNode *gnode, *cnode, *bnode;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
62 GaimBuddy *buddy;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
63
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
64 blist = gaim_get_blist();
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
65 if (blist == NULL)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
66 return;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
67
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
68 /* Go through and remove all buddies that belong to this account */
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
69 for (gnode = blist->root; gnode; gnode = gnode->next)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
70 {
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
71 if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
72 continue;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
73 for (cnode = gnode->child; cnode; cnode = cnode->next)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
74 {
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
75 if (!GAIM_BLIST_NODE_IS_CONTACT(cnode))
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
76 continue;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
77 for (bnode = cnode->child; bnode; bnode = bnode->next)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
78 {
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
79 if (!GAIM_BLIST_NODE_IS_BUDDY(bnode))
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
80 continue;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
81 buddy = (GaimBuddy *)bnode;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
82 if (buddy->account != account)
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
83 continue;
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
84 gaim_prpl_got_user_status(account, buddy->name, "offline", NULL);
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
85 gaim_blist_remove_buddy(buddy);
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
86 }
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
87 }
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
88 }
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
89 }
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
90
12443
488a305f9aff [gaim-migrate @ 14750]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12339
diff changeset
91 static void
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11835
diff changeset
92 bonjour_login(GaimAccount *account)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
93 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
94 GaimConnection *gc = gaim_account_get_connection(account);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
95 GaimGroup *bonjour_group = NULL;
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
96 BonjourData *bd = NULL;
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11835
diff changeset
97 GaimStatus *status;
11834
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
98 GaimPresence *presence;
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
99
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
100 gc->flags |= GAIM_CONNECTION_HTML;
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
101 gc->proto_data = g_new0(BonjourData, 1);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
102 bd = gc->proto_data;
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
103
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
104 /* Start waiting for jabber connections (iChat style) */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
105 bd->jabber_data = g_new(BonjourJabber, 1);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
106 bd->jabber_data->port = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
107 bd->jabber_data->account = account;
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
108
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
109 if (bonjour_jabber_start(bd->jabber_data) == -1) {
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
110 /* Send a message about the connection error */
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
111 gaim_connection_error(gc, _("Unable to listen for incoming IM connections\n"));
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
112
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
113 /* Free the data */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
114 g_free(bd->jabber_data);
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
115 bd->jabber_data = NULL;
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
116 return;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
117 }
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
118
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
119 /* Connect to the mDNS daemon looking for buddies in the LAN */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
120 bd->dns_sd_data = bonjour_dns_sd_new();
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
121 bd->dns_sd_data->name = (sw_string)gaim_account_get_username(account);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
122 bd->dns_sd_data->txtvers = g_strdup("1");
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
123 bd->dns_sd_data->version = g_strdup("1");
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
124 bd->dns_sd_data->first = g_strdup(gaim_account_get_string(account, "first", default_firstname));
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
125 bd->dns_sd_data->last = g_strdup(gaim_account_get_string(account, "last", default_lastname));
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
126 bd->dns_sd_data->port_p2pj = gaim_account_get_int(account, "port", BONJOUR_DEFAULT_PORT_INT);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
127 bd->dns_sd_data->phsh = g_strdup("");
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
128 bd->dns_sd_data->email = g_strdup(gaim_account_get_string(account, "email", ""));
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
129 bd->dns_sd_data->vc = g_strdup("");
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
130 bd->dns_sd_data->jid = g_strdup("");
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
131 bd->dns_sd_data->AIM = g_strdup("");
11834
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
132
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
133 status = gaim_account_get_active_status(account);
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
134 presence = gaim_account_get_presence(account);
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
135 if (gaim_presence_is_available(presence))
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
136 bd->dns_sd_data->status = g_strdup("avail");
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
137 else if (gaim_presence_is_idle(presence))
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
138 bd->dns_sd_data->status = g_strdup("away");
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
139 else
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
140 bd->dns_sd_data->status = g_strdup("dnd");
825d3ca6ffcd [gaim-migrate @ 14125]
Mark Doliner <mark@kingant.net>
parents: 11829
diff changeset
141 bd->dns_sd_data->msg = g_strdup(gaim_status_get_attr_string(status, "message"));
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
142
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
143 bd->dns_sd_data->account = account;
11927
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11841
diff changeset
144 if (!bonjour_dns_sd_start(bd->dns_sd_data))
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11841
diff changeset
145 {
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11841
diff changeset
146 gaim_connection_error(gc, _("Unable to establish connection with the local mDNS server. Is it running?"));
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11841
diff changeset
147 return;
0d9c6d2ad64b [gaim-migrate @ 14218]
Mark Doliner <mark@kingant.net>
parents: 11841
diff changeset
148 }
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
149
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
150 /* Create a group for bonjour buddies */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
151 bonjour_group = gaim_group_new(BONJOUR_GROUP_NAME);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
152 gaim_blist_add_group(bonjour_group, NULL);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
153
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
154 /* Show the buddy list by telling Gaim we have already connected */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
155 gaim_connection_set_state(gc, GAIM_CONNECTED);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
156 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
157
12443
488a305f9aff [gaim-migrate @ 14750]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12339
diff changeset
158 static void
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
159 bonjour_close(GaimConnection *connection)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
160 {
13063
41ec0316cd65 [gaim-migrate @ 15425]
Mark Doliner <mark@kingant.net>
parents: 13061
diff changeset
161 GaimGroup *bonjour_group;
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
162 BonjourData *bd = (BonjourData*)connection->proto_data;
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
163
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
164 /* Stop looking for buddies in the LAN */
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
165 if (bd->dns_sd_data != NULL)
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
166 {
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
167 bonjour_dns_sd_stop(bd->dns_sd_data);
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
168 bonjour_dns_sd_free(bd->dns_sd_data);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
169 }
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
170
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
171 if (bd->jabber_data != NULL)
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
172 {
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
173 /* Stop waiting for conversations */
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
174 bonjour_jabber_stop(bd->jabber_data);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
175 g_free(bd->jabber_data);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
176 }
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
177
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
178 /* Remove all the bonjour buddies */
11691
739d6376dec2 [gaim-migrate @ 13977]
Mark Doliner <mark@kingant.net>
parents: 11539
diff changeset
179 bonjour_removeallfromlocal(connection);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
180
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
181 /* Delete the bonjour group */
13063
41ec0316cd65 [gaim-migrate @ 15425]
Mark Doliner <mark@kingant.net>
parents: 13061
diff changeset
182 bonjour_group = gaim_find_group(BONJOUR_GROUP_NAME);
41ec0316cd65 [gaim-migrate @ 15425]
Mark Doliner <mark@kingant.net>
parents: 13061
diff changeset
183 if (bonjour_group != NULL)
41ec0316cd65 [gaim-migrate @ 15425]
Mark Doliner <mark@kingant.net>
parents: 13061
diff changeset
184 gaim_blist_remove_group(bonjour_group);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
185
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
186 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
187
12443
488a305f9aff [gaim-migrate @ 14750]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12339
diff changeset
188 static const char *
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
189 bonjour_list_icon(GaimAccount *account, GaimBuddy *buddy)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
190 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
191 return BONJOUR_ICON_NAME;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
192 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
193
12443
488a305f9aff [gaim-migrate @ 14750]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12339
diff changeset
194 static int
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12143
diff changeset
195 bonjour_send_im(GaimConnection *connection, const char *to, const char *msg, GaimMessageFlags flags)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
196 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
197 if(!to || !msg)
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
198 return 0;
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
199
11693
b91a84e7cbcb [gaim-migrate @ 13979]
Mark Doliner <mark@kingant.net>
parents: 11691
diff changeset
200 return bonjour_jabber_send_message(((BonjourData*)(connection->proto_data))->jabber_data, to, msg);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
201 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
202
12443
488a305f9aff [gaim-migrate @ 14750]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12339
diff changeset
203 static void
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
204 bonjour_set_status(GaimAccount *account, GaimStatus *status)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
205 {
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
206 GaimConnection *gc;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
207 BonjourData *bd;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
208 gboolean disconnected;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
209 GaimStatusType *type;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
210 int primitive;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
211 GaimPresence *presence;
11841
f91b4fedd8b5 [gaim-migrate @ 14132]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11839
diff changeset
212 const char *message, *bonjour_status;
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
213 gchar *stripped;
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
214
11839
216a05e0a6f1 [gaim-migrate @ 14130]
Mark Doliner <mark@kingant.net>
parents: 11837
diff changeset
215 gc = gaim_account_get_connection(account);
216a05e0a6f1 [gaim-migrate @ 14130]
Mark Doliner <mark@kingant.net>
parents: 11837
diff changeset
216 bd = gc->proto_data;
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
217 disconnected = gaim_account_is_disconnected(account);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
218 type = gaim_status_get_type(status);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
219 primitive = gaim_status_type_get_primitive(type);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
220 presence = gaim_account_get_presence(account);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
221
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
222 message = gaim_status_get_attr_string(status, "message");
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
223 if (message == NULL)
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
224 message = "";
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
225 stripped = gaim_markup_strip_html(message);
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
226
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
227 /*
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
228 * The three possible status for Bonjour are
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
229 * -available ("avail")
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
230 * -idle ("away")
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
231 * -away ("dnd")
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
232 * Each of them can have an optional message.
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
233 */
11835
36c2e09c2cf9 [gaim-migrate @ 14126]
Mark Doliner <mark@kingant.net>
parents: 11834
diff changeset
234 if (gaim_presence_is_available(presence))
11841
f91b4fedd8b5 [gaim-migrate @ 14132]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11839
diff changeset
235 bonjour_status = "avail";
11835
36c2e09c2cf9 [gaim-migrate @ 14126]
Mark Doliner <mark@kingant.net>
parents: 11834
diff changeset
236 else if (gaim_presence_is_idle(presence))
11841
f91b4fedd8b5 [gaim-migrate @ 14132]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11839
diff changeset
237 bonjour_status = "away";
11835
36c2e09c2cf9 [gaim-migrate @ 14126]
Mark Doliner <mark@kingant.net>
parents: 11834
diff changeset
238 else
11841
f91b4fedd8b5 [gaim-migrate @ 14132]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11839
diff changeset
239 bonjour_status = "dnd";
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
240
13061
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
241 bonjour_dns_sd_send_status(bd->dns_sd_data, bonjour_status, stripped);
6332531e14a7 [gaim-migrate @ 15423]
Mark Doliner <mark@kingant.net>
parents: 12970
diff changeset
242 g_free(stripped);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
243 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
244
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
245 static GList *
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
246 bonjour_status_types(GaimAccount *account)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
247 {
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
248 GList *status_types = NULL;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
249 GaimStatusType *type;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
250
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
251 g_return_val_if_fail(account != NULL, NULL);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
252
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
253 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE,
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
254 BONJOUR_STATUS_ID_AVAILABLE,
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
255 NULL, TRUE, TRUE, FALSE,
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
256 "message", _("Message"),
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
257 gaim_value_new(GAIM_TYPE_STRING), NULL);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
258 status_types = g_list_append(status_types, type);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
259
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
260 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY,
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
261 BONJOUR_STATUS_ID_AWAY,
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
262 NULL, TRUE, TRUE, FALSE,
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
263 "message", _("Message"),
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
264 gaim_value_new(GAIM_TYPE_STRING), NULL);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
265 status_types = g_list_append(status_types, type);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
266
12658
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12650
diff changeset
267 type = gaim_status_type_new_full(GAIM_STATUS_OFFLINE,
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12650
diff changeset
268 BONJOUR_STATUS_ID_OFFLINE,
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12650
diff changeset
269 NULL, TRUE, TRUE, FALSE);
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12650
diff changeset
270 status_types = g_list_append(status_types, type);
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12650
diff changeset
271
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
272 return status_types;
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
273 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
274
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
275 static void
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
276 bonjour_convo_closed(GaimConnection *connection, const char *who)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
277 {
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
278 GaimBuddy *buddy = gaim_find_buddy(connection->account, who);
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
279
11966
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
280 if (buddy == NULL)
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
281 {
11966
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
282 /*
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
283 * This buddy is not in our buddy list, and therefore does not really
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
284 * exist, so we won't have any data about them.
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
285 */
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
286 return;
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
287 }
11966
bf4fe41d5e94 [gaim-migrate @ 14258]
Mark Doliner <mark@kingant.net>
parents: 11927
diff changeset
288
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
289 bonjour_jabber_close_conversation(((BonjourData*)(connection->proto_data))->jabber_data, buddy);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
290 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
291
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
292 static void
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
293 bonjour_list_emblems(GaimBuddy *buddy,
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
294 const char **se, const char **sw,
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
295 const char **nw, const char **ne)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
296 {
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
297 GaimPresence *presence;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
298
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
299 presence = gaim_buddy_get_presence(buddy);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
300
12339
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
301 if (gaim_presence_is_online(presence) && !gaim_presence_is_available(presence))
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
302 *se = "away";
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
303 }
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
304
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
305 static char *
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
306 bonjour_status_text(GaimBuddy *buddy)
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
307 {
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
308 GaimPresence *presence;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
309
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
310 presence = gaim_buddy_get_presence(buddy);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
311
12339
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
312 if (gaim_presence_is_online(presence) && !gaim_presence_is_available(presence))
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
313 return g_strdup("Away");
12339
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
314
fdac1c5e6c68 [gaim-migrate @ 14643]
Mark Doliner <mark@kingant.net>
parents: 12216
diff changeset
315 return NULL;
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
316 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
317
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
318 static void
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
319 bonjour_tooltip_text(GaimBuddy *buddy, GString *str, gboolean full)
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
320 {
11496
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
321 GaimPresence *presence;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
322 GaimStatus *status;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
323 const char *status_description;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
324 const char *message;
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
325
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
326 presence = gaim_buddy_get_presence(buddy);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
327 status = gaim_presence_get_active_status(presence);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
328 message = gaim_status_get_attr_string(status, "message");
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
329
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
330 if (gaim_presence_is_available(presence))
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
331 status_description = gaim_status_get_name(status);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
332 else if (gaim_presence_is_idle(presence))
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
333 status_description = _("Idle");
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
334 else
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
335 status_description = gaim_status_get_name(status);
3f038da50a18 [gaim-migrate @ 13740]
Mark Doliner <mark@kingant.net>
parents: 11477
diff changeset
336
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
337 g_string_append_printf(str, _("\n<b>Status:</b> %s"), status_description);
11519
0dfda214df89 [gaim-migrate @ 13764]
Mark Doliner <mark@kingant.net>
parents: 11515
diff changeset
338 if (message != NULL)
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
339 g_string_append_printf(str, _("\n<b>Message:</b> %s"), message);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
340 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
341
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
342 static gboolean
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
343 plugin_unload(GaimPlugin *plugin)
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
344 {
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
345 g_free(default_firstname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
346 g_free(default_lastname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
347 g_free(default_hostname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
348
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
349 return TRUE;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
350 }
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
351
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
352 static GaimPlugin *my_protocol = NULL;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
353
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
354 static GaimPluginProtocolInfo prpl_info =
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
355 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
356 OPT_PROTO_NO_PASSWORD,
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
357 NULL, /* user_splits */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
358 NULL, /* protocol_options */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
359 {"png", 0, 0, 96, 96, GAIM_ICON_SCALE_DISPLAY}, /* icon_spec */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
360 bonjour_list_icon, /* list_icon */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
361 bonjour_list_emblems, /* list_emblems */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
362 bonjour_status_text, /* status_text */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
363 bonjour_tooltip_text, /* tooltip_text */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
364 bonjour_status_types, /* status_types */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
365 NULL, /* blist_node_menu */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
366 NULL, /* chat_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
367 NULL, /* chat_info_defaults */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
368 bonjour_login, /* login */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
369 bonjour_close, /* close */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
370 bonjour_send_im, /* send_im */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
371 NULL, /* set_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
372 NULL, /* send_typing */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
373 NULL, /* get_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
374 bonjour_set_status, /* set_status */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
375 NULL, /* set_idle */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
376 NULL, /* change_passwd */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
377 NULL, /* add_buddy */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
378 NULL, /* add_buddies */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
379 NULL, /* remove_buddy */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
380 NULL, /* remove_buddies */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
381 NULL, /* add_permit */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
382 NULL, /* add_deny */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
383 NULL, /* rem_permit */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
384 NULL, /* rem_deny */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
385 NULL, /* set_permit_deny */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
386 NULL, /* join_chat */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
387 NULL, /* reject_chat */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
388 NULL, /* get_chat_name */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
389 NULL, /* chat_invite */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
390 NULL, /* chat_leave */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
391 NULL, /* chat_whisper */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
392 NULL, /* chat_send */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
393 NULL, /* keepalive */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
394 NULL, /* register_user */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
395 NULL, /* get_cb_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
396 NULL, /* get_cb_away */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
397 NULL, /* alias_buddy */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
398 NULL, /* group_buddy */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
399 NULL, /* rename_group */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
400 NULL, /* buddy_free */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
401 bonjour_convo_closed, /* convo_closed */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
402 NULL, /* normalize */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
403 NULL, /* set_buddy_icon */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
404 NULL, /* remove_group */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
405 NULL, /* get_cb_real_name */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
406 NULL, /* set_chat_topic */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
407 NULL, /* find_blist_chat */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
408 NULL, /* roomlist_get_list */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
409 NULL, /* roomlist_cancel */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
410 NULL, /* roomlist_expand_category */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
411 NULL, /* can_receive_file */
12143
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 12003
diff changeset
412 NULL, /* send_file */
12607
78048f8af66f [gaim-migrate @ 14943]
Mark Doliner <mark@kingant.net>
parents: 12595
diff changeset
413 NULL, /* new_xfer */
12650
2926e3c3185e [gaim-migrate @ 14988]
Mark Doliner <mark@kingant.net>
parents: 12607
diff changeset
414 NULL, /* offline_message */
12607
78048f8af66f [gaim-migrate @ 14943]
Mark Doliner <mark@kingant.net>
parents: 12595
diff changeset
415 NULL, /* whiteboard_prpl_ops */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
416 };
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
417
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
418 static GaimPluginInfo info =
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
419 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
420 GAIM_PLUGIN_MAGIC,
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
421 GAIM_MAJOR_VERSION,
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
422 GAIM_MINOR_VERSION,
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
423 GAIM_PLUGIN_PROTOCOL, /**< type */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
424 NULL, /**< ui_requirement */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
425 0, /**< flags */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
426 NULL, /**< dependencies */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
427 GAIM_PRIORITY_DEFAULT, /**< priority */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
428
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
429 "prpl-bonjour", /**< id */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
430 "Bonjour", /**< name */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
431 VERSION, /**< version */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
432 /** summary */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
433 N_("Bonjour Protocol Plugin"),
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
434 /** description */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
435 N_("Bonjour Protocol Plugin"),
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
436 NULL, /**< author */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
437 GAIM_WEBSITE, /**< homepage */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
438
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
439 NULL, /**< load */
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
440 plugin_unload, /**< unload */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
441 NULL, /**< destroy */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
442
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
443 NULL, /**< ui_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
444 &prpl_info, /**< extra_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
445 NULL, /**< prefs_info */
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
446 NULL
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
447 };
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
448
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
449 static void
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
450 initialize_default_account_values()
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
451 {
13191
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
452 #ifdef _WIN32
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
453 char *fullname = NULL;
13191
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
454 #else
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
455 struct passwd *info;
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
456 const char *fullname = NULL;
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
457 #endif
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
458 char *splitpoint = NULL;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
459 char hostname[255];
13191
a0dfbd5c3b03 [gaim-migrate @ 15554]
Mark Doliner <mark@kingant.net>
parents: 13075
diff changeset
460
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
461 #ifndef _WIN32
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
462 /* Try to figure out the user's real name */
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
463 info = getpwuid(getuid());
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
464 if ((info != NULL) && (info->pw_gecos != NULL) && (info->pw_gecos[0] != '\0'))
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
465 fullname = info->pw_gecos;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
466 else if ((info != NULL) && (info->pw_name != NULL) && (info->pw_name[0] != '\0'))
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
467 fullname = info->pw_name;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
468 else if (((fullname = getlogin()) != NULL) && (fullname[0] != '\0'))
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
469 ;
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
470 else
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
471 fullname = _("Gaim User");
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
472
13075
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
473 /* Make sure fullname is valid UTF-8. If not, try to convert it. */
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
474 if (!g_utf8_validate(fullname, -1, NULL))
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
475 {
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
476 gchar *tmp;
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
477 tmp = g_locale_to_utf8(fullname, -1, NULL, NULL, NULL);
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
478 if ((tmp == NULL) || (*tmp == '\0'))
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
479 fullname = _("Gaim User");
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
480 }
4b7a8787432c [gaim-migrate @ 15437]
Mark Doliner <mark@kingant.net>
parents: 13063
diff changeset
481
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
482 #else
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
483 FARPROC myNetUserGetInfo = wgaim_find_and_loadproc("Netapi32.dll",
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
484 "NetUserGetInfo");
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
485
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
486 if (myNetUserGetInfo) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
487 LPUSER_INFO_10 user_info = NULL;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
488 LPSERVER_INFO_100 server_info = NULL;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
489 wchar_t *servername = NULL;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
490 wchar_t username[UNLEN + 1] = {'\0'};
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
491 DWORD dwLenUsername = sizeof(username);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
492 FARPROC myNetServerEnum = wgaim_find_and_loadproc(
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
493 "Netapi32.dll", "NetServerEnum");
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
494 FARPROC myNetApiBufferFree = wgaim_find_and_loadproc(
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
495 "Netapi32.dll", "NetApiBufferFree");
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
496
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
497 if (myNetServerEnum && myNetApiBufferFree) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
498 DWORD dwEntriesRead = 0;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
499 DWORD dwTotalEntries = 0;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
500 DWORD dwResumeHandle = 0;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
501
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
502 NET_API_STATUS nStatus = (myNetServerEnum)(NULL, 100,
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
503 &server_info, MAX_PREFERRED_LENGTH,
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
504 &dwEntriesRead, &dwTotalEntries,
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
505 SV_TYPE_DOMAIN_CTRL, NULL, &dwResumeHandle);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
506
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
507 if ((nStatus == NERR_Success
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
508 || nStatus == ERROR_MORE_DATA)
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
509 && dwEntriesRead > 0) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
510 servername = server_info->sv100_name;
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
511 } else {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
512 gaim_debug_warning("bonjour", "Unable to look up domain controller. NET_API_STATUS = %d, Entries Read = %d, Total Entries = %d\n", nStatus, dwEntriesRead, dwTotalEntries);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
513 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
514 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
515
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
516 if (!GetUserNameW(&username, &dwLenUsername)) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
517 gaim_debug_warning("bonjour",
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
518 "Unable to look up username\n");
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
519 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
520
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
521 if (username != NULL && *username != '\0'
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
522 && (myNetUserGetInfo)(servername, username, 10,
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
523 &user_info) == NERR_Success) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
524 if (user_info != NULL) {
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
525 fullname = g_utf16_to_utf8(
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
526 user_info->usri10_full_name,
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
527 -1, NULL, NULL, NULL);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
528 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
529 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
530 if (user_info != NULL)
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
531 (myNetApiBufferFree)(user_info);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
532 if (server_info != NULL)
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
533 (myNetApiBufferFree)(server_info);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
534 }
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
535
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
536 if (!fullname)
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
537 fullname = g_strdup(_("Gaim User"));
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
538 #endif
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
539
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
540 /* Split the real name into a first and last name */
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
541 splitpoint = strchr(fullname, ' ');
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
542 if (splitpoint != NULL)
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
543 {
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
544 default_firstname = g_strndup(fullname, splitpoint - fullname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
545 default_lastname = g_strdup(&splitpoint[1]);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
546 }
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
547 else
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
548 {
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
549 default_firstname = g_strdup(fullname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
550 default_lastname = g_strdup("");
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
551 }
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
552
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
553 #ifdef _WIN32
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
554 g_free(fullname);
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
555 #endif
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
556
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
557 /* Try to figure out a good host name to use */
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
558 /* TODO: Avoiding 'localhost,' if possible */
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
559 if (gethostname(hostname, 255) != 0) {
12003
13da3f228bbb [gaim-migrate @ 14296]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11984
diff changeset
560 gaim_debug_warning("bonjour", "Error %d when getting host name. Using \"localhost.\"\n", errno);
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
561 strcpy(hostname, "localhost");
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
562 }
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
563 default_hostname = g_strdup(hostname);
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
564 }
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
565
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
566 static void
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
567 init_plugin(GaimPlugin *plugin)
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
568 {
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
569 GaimAccountUserSplit *split;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
570 GaimAccountOption *option;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
571
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
572 initialize_default_account_values();
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
573
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
574 /* Creating the user splits */
12489
12db50600de5 [gaim-migrate @ 14801]
Mark Doliner <mark@kingant.net>
parents: 12443
diff changeset
575 split = gaim_account_user_split_new(_("Hostname"), default_hostname, '@');
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
576 prpl_info.user_splits = g_list_append(prpl_info.user_splits, split);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
577
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11718
diff changeset
578 /* Creating the options for the protocol */
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
579 option = gaim_account_option_int_new(_("Port"), "port", 5298);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
580 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
581
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
582 option = gaim_account_option_string_new(_("First name"), "first", default_firstname);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
583 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
584
11984
59494e5f7fdf [gaim-migrate @ 14277]
Mark Doliner <mark@kingant.net>
parents: 11966
diff changeset
585 option = gaim_account_option_string_new(_("Last name"), "last", default_lastname);
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
586 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
587
13545
cfc2f7fcb3dd [gaim-migrate @ 15922]
Richard Laager <rlaager@wiktel.com>
parents: 13296
diff changeset
588 option = gaim_account_option_string_new(_("E-mail"), "email", "");
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
589 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
11539
5a2c38d33eb4 [gaim-migrate @ 13794]
Mark Doliner <mark@kingant.net>
parents: 11519
diff changeset
590
11477
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
591 my_protocol = plugin;
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
592 }
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
593
36f575351c49 [gaim-migrate @ 13719]
Mark Doliner <mark@kingant.net>
parents:
diff changeset
594 GAIM_INIT_PLUGIN(bonjour, init_plugin, info);