Mon, 25 Jun 2007 02:16:58 +0000
More compile fixes from rekkanoryo for G_GNUC_NULL_TERMINATED issues
| 11477 | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or modify | |
| 3 | * it under the terms of the GNU General Public License as published by | |
| 4 | * the Free Software Foundation; either version 2 of the License, or | |
| 5 | * (at your option) any later version. | |
| 6 | * | |
| 7 | * This program is distributed in the hope that it will be useful, | |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 10 | * GNU Library General Public License for more details. | |
| 11 | * | |
| 12 | * You should have received a copy of the GNU General Public License | |
| 13 | * along with this program; if not, write to the Free Software | |
| 14 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
| 15 | */ | |
| 16 | ||
| 17 | #include <glib.h> | |
| 18 | #include <stdlib.h> | |
| 19 | ||
|
18338
d3cb08f27e04
More compile fixes from rekkanoryo for G_GNUC_NULL_TERMINATED issues
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17663
diff
changeset
|
20 | #include "internal.h" |
| 11477 | 21 | #include "buddy.h" |
| 22 | #include "account.h" | |
| 23 | #include "blist.h" | |
| 24 | #include "bonjour.h" | |
| 25 | #include "debug.h" | |
| 26 | ||
| 27 | /** | |
| 28 | * Creates a new buddy. | |
| 29 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
30 | BonjourBuddy * |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
31 | bonjour_buddy_new(const gchar *name, PurpleAccount* account) |
| 11477 | 32 | { |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
33 | BonjourBuddy *buddy = g_new0(BonjourBuddy, 1); |
| 11477 | 34 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
35 | buddy->account = account; |
| 11477 | 36 | buddy->name = g_strdup(name); |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
37 | |
| 11477 | 38 | return buddy; |
| 39 | } | |
| 40 | ||
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
41 | void |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
42 | set_bonjour_buddy_value(BonjourBuddy* buddy, const char *record_key, const char *value, uint32_t len){ |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
43 | gchar **fld = NULL; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
44 | |
|
17611
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
45 | if (!strcmp(record_key, "1st")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
46 | fld = &buddy->first; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
47 | else if(!strcmp(record_key, "email")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
48 | fld = &buddy->email; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
49 | else if(!strcmp(record_key, "ext")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
50 | fld = &buddy->ext; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
51 | else if(!strcmp(record_key, "jid")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
52 | fld = &buddy->jid; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
53 | else if(!strcmp(record_key, "last")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
54 | fld = &buddy->last; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
55 | else if(!strcmp(record_key, "msg")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
56 | fld = &buddy->msg; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
57 | else if(!strcmp(record_key, "nick")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
58 | fld = &buddy->nick; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
59 | else if(!strcmp(record_key, "node")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
60 | fld = &buddy->node; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
61 | else if(!strcmp(record_key, "phsh")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
62 | fld = &buddy->phsh; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
63 | else if(!strcmp(record_key, "status")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
64 | fld = &buddy->status; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
65 | else if(!strcmp(record_key, "vc")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
66 | fld = &buddy->vc; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
67 | else if(!strcmp(record_key, "ver")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
68 | fld = &buddy->ver; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
69 | else if(!strcmp(record_key, "AIM")) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
70 | fld = &buddy->AIM; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
71 | |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
72 | if(fld == NULL) |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
73 | return; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
74 | |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
75 | g_free(*fld); |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
76 | *fld = NULL; |
|
1f221c4f82d6
Improve bonjour buddy TXT record parsing.
Daniel Atallah <datallah@pidgin.im>
parents:
17599
diff
changeset
|
77 | *fld = g_strndup(value, len); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
78 | } |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
79 | |
| 11477 | 80 | /** |
| 81 | * Check if all the compulsory buddy data is present. | |
| 82 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
83 | gboolean |
|
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
84 | bonjour_buddy_check(BonjourBuddy *buddy) |
| 11477 | 85 | { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
86 | if (buddy->account == NULL) |
| 11477 | 87 | return FALSE; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
88 | |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
89 | if (buddy->name == NULL) |
| 11477 | 90 | return FALSE; |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
91 | |
| 11477 | 92 | return TRUE; |
| 93 | } | |
| 94 | ||
| 95 | /** | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
96 | * If the buddy does not yet exist, then create it and add it to |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
97 | * our buddy list. In either case we set the correct status for |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
98 | * the buddy. |
| 11477 | 99 | */ |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
100 | void |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
101 | bonjour_buddy_add_to_purple(BonjourBuddy *bonjour_buddy) |
| 11477 | 102 | { |
| 15884 | 103 | PurpleBuddy *buddy; |
| 104 | PurpleGroup *group; | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
105 | const char *status_id, *first, *last; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
106 | gchar *alias; |
|
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
107 | |
| 15884 | 108 | /* Translate between the Bonjour status and the Purple status */ |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
109 | if (g_ascii_strcasecmp("dnd", bonjour_buddy->status) == 0) |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
110 | status_id = BONJOUR_STATUS_ID_AWAY; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
111 | else |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
112 | status_id = BONJOUR_STATUS_ID_AVAILABLE; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
113 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
114 | /* |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
115 | * TODO: Figure out the idle time by getting the "away" |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
116 | * field from the DNS SD. |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
117 | */ |
| 11477 | 118 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
119 | /* Create the alias for the buddy using the first and the last name */ |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
120 | first = bonjour_buddy->first; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
121 | last = bonjour_buddy->last; |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
122 | alias = g_strdup_printf("%s%s%s", |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
123 | (first && *first ? first : ""), |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
124 | (first && *first && last && *last ? " " : ""), |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
125 | (last && *last ? last : "")); |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
126 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
127 | /* Make sure the Bonjour group exists in our buddy list */ |
| 15884 | 128 | group = purple_find_group(BONJOUR_GROUP_NAME); /* Use the buddy's domain, instead? */ |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
129 | if (group == NULL) |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
130 | { |
| 15884 | 131 | group = purple_group_new(BONJOUR_GROUP_NAME); |
| 132 | purple_blist_add_group(group, NULL); | |
| 11477 | 133 | } |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
134 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
135 | /* Make sure the buddy exists in our buddy list */ |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
136 | buddy = purple_find_buddy(bonjour_buddy->account, bonjour_buddy->name); |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
137 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
138 | if (buddy == NULL) |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
139 | { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
140 | buddy = purple_buddy_new(bonjour_buddy->account, bonjour_buddy->name, alias); |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
141 | buddy->proto_data = bonjour_buddy; |
| 15884 | 142 | purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE); |
| 143 | purple_blist_add_buddy(buddy, NULL, group, NULL); | |
| 11477 | 144 | } |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
145 | |
|
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
146 | /* Set the user's status */ |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
147 | if (bonjour_buddy->msg != NULL) |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
148 | purple_prpl_got_user_status(bonjour_buddy->account, buddy->name, status_id, |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
149 | "message", bonjour_buddy->msg, |
|
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
150 | NULL); |
|
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
151 | else |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
152 | purple_prpl_got_user_status(bonjour_buddy->account, buddy->name, status_id, |
|
11519
abb61e69b1cf
[gaim-migrate @ 13764]
Mark Doliner <markdoliner@pidgin.im>
parents:
11496
diff
changeset
|
153 | NULL); |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
154 | purple_prpl_got_user_idle(bonjour_buddy->account, buddy->name, FALSE, 0); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
155 | |
|
11496
0f61069a4a3f
[gaim-migrate @ 13740]
Mark Doliner <markdoliner@pidgin.im>
parents:
11477
diff
changeset
|
156 | g_free(alias); |
| 11477 | 157 | } |
| 158 | ||
| 159 | /** | |
| 160 | * Deletes a buddy from memory. | |
| 161 | */ | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
162 | void |
|
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
163 | bonjour_buddy_delete(BonjourBuddy *buddy) |
| 11477 | 164 | { |
| 165 | g_free(buddy->name); | |
| 17631 | 166 | g_free(buddy->ip); |
| 167 | ||
| 11477 | 168 | g_free(buddy->first); |
| 169 | g_free(buddy->phsh); | |
| 170 | g_free(buddy->status); | |
| 171 | g_free(buddy->email); | |
| 172 | g_free(buddy->last); | |
| 173 | g_free(buddy->jid); | |
| 174 | g_free(buddy->AIM); | |
| 175 | g_free(buddy->vc); | |
| 176 | g_free(buddy->msg); | |
| 17631 | 177 | g_free(buddy->ext); |
| 178 | g_free(buddy->nick); | |
| 179 | g_free(buddy->node); | |
| 180 | g_free(buddy->ver); | |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
181 | |
|
17663
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17631
diff
changeset
|
182 | bonjour_jabber_close_conversation(buddy->conversation); |
|
fd736a4d91a9
Close conversation connections when logging out of the Bonjour account. This also fixes leakage.
Daniel Atallah <datallah@pidgin.im>
parents:
17631
diff
changeset
|
183 | buddy->conversation = NULL; |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
184 | |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
185 | #ifdef USE_BONJOUR_APPLE |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
186 | if (buddy->txt_query != NULL) |
|
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
187 | { |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
188 | purple_input_remove(buddy->txt_query_fd); |
|
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
189 | DNSServiceRefDeallocate(buddy->txt_query); |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
190 | } |
|
17596
45f6190fe54a
This is a patch from Chris Davies to make Bonjour work on Windows using the Apple Bonjour framework. It turns out that the actual DNS-SD library is (3 clause) BSD licensed, so we can use it.
Daniel Atallah <datallah@pidgin.im>
parents:
15884
diff
changeset
|
191 | #endif |
|
11539
fbabe3f89777
[gaim-migrate @ 13794]
Mark Doliner <markdoliner@pidgin.im>
parents:
11519
diff
changeset
|
192 | |
|
17599
8b0aa6917c6d
Don't force Bonjour buddies to have firstname, lastname and status TXT records - they are optional. Also, minor cleanup and use glib to allocate memory instead of the crt.
Daniel Atallah <datallah@pidgin.im>
parents:
17596
diff
changeset
|
193 | g_free(buddy); |
| 11477 | 194 | } |