annotate src/protocols/novell/nmconference.c @ 10791:2ab4b5acc8d1

[gaim-migrate @ 12433] " When you autocomplete a screenname in a dialog box that also includes an account selector, it should also autocomplete the account. This patch implements that." --rlaager this is how I would expect things to work. I was hit by this just the other day. committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 07 Apr 2005 15:22:21 +0000
parents 6663ad2386d9
children 11742521716f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2 * nmconference.c
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
4 * Copyright (c) 2004 Novell, Inc. All Rights Reserved.
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
5 *
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
6 * This program is free software; you can redistribute it and/or modify
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
7 * it under the terms of the GNU General Public License as published by
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
8 * the Free Software Foundation; version 2 of the License.
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 *
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
10 * This program is distributed in the hope that it will be useful,
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
13 * GNU General Public License for more details.
8684
046dd8ef2920 [gaim-migrate @ 9437]
Christian Hammond <chipx86@chipx86.com>
parents: 8675
diff changeset
14 *
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
15 * You should have received a copy of the GNU General Public License
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
16 * along with this program; if not, write to the Free Software
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 *
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
20
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 #include <string.h>
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 #include "nmconference.h"
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 static int conf_count = 0;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 struct _NMConference
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 /* The conference identifier */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 char *guid;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
31
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 /* The list of participants for the conference */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
33 GSList *participants;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 /* Flags for the conference */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 guint32 flags;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 /* User defined data */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 gpointer data;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 /* Reference count for this object */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
42 int ref_count;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 };
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
46
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 /*******************************************************************************
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 * Conference API -- see header file for comments
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 ******************************************************************************/
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 NMConference *
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 nm_create_conference(const char *guid)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 NMConference *conf = g_new0(NMConference, 1);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 if (guid) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57 conf->guid = g_strdup(guid);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
58 } else {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
59 conf->guid = g_strdup(BLANK_GUID);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
60 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
61 conf->ref_count = 1;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
62
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
63 gaim_debug(GAIM_DEBUG_INFO, "novell",
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
64 "Creating a conference %p, total=%d\n",
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
65 conf, conf_count++);
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
66
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
67 return conf;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
68 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
70 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 nm_release_conference(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73 GSList *node;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 gaim_debug(GAIM_DEBUG_INFO, "novell",
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
76 "In release conference %p, refs=%d\n",
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
77 conference, conference->ref_count);
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 if (conference != NULL && (--conference->ref_count == 0)) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 gaim_debug(GAIM_DEBUG_INFO, "novell",
8933
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
81 "Releasing conference %p, total=%d\n",
6663ad2386d9 [gaim-migrate @ 9703]
Luke Schierer <lschiere@pidgin.im>
parents: 8684
diff changeset
82 conference, --conf_count);
8675
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 if (conference->guid)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 g_free(conference->guid);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 if (conference->participants) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 for (node = conference->participants; node; node = node->next) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 if (node->data) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 NMUserRecord *user_record = node->data;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 nm_release_user_record(user_record);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 node->data = NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 g_slist_free(conference->participants);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 g_free(conference);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 gboolean
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 nm_conference_is_instantiated(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 return FALSE;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 return (strncmp(conference->guid, BLANK_GUID, CONF_GUID_END) != 0);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 int
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 nm_conference_get_participant_count(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 return 0;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 return g_slist_length(conference->participants);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 NMUserRecord *
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 nm_conference_get_participant(NMConference * conference, int index)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 return NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 return (NMUserRecord *) g_slist_nth_data(conference->participants, index);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 nm_conference_add_participant(NMConference * conference,
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
133 NMUserRecord * user_record)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135 if (conference == NULL || user_record == NULL) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 return;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
139 nm_user_record_add_ref(user_record);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 conference->participants = g_slist_append(conference->participants, user_record);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
141 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
142
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
143 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
144 nm_conference_remove_participant(NMConference * conference, const char *dn)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146 GSList *node, *element = NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
147
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 if (conference == NULL || dn == NULL) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
149 return;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 for (node = conference->participants; node; node = node->next) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 NMUserRecord *user_record = node->data;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 if (user_record) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156 if (nm_utf8_str_equal(dn, nm_user_record_get_dn(user_record))) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 element = node;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 break;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
161 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 if (element) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 nm_release_user_record((NMUserRecord *) element->data);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165 element->data = NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 conference->participants =
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 g_slist_remove_link(conference->participants, element);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 g_slist_free_1(element);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 nm_conference_add_ref(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 if (conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 conference->ref_count++;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 nm_conference_set_flags(NMConference * conference, guint32 flags)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 if (conference) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 conference->flags = flags;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 nm_conference_set_guid(NMConference * conference, const char *guid)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 if (conference) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 /* Release memory for old guid */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 if (conference->guid) {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 g_free(conference->guid);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 /* Set the new guid */
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 if (guid)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 conference->guid = g_strdup(guid);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 else
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
201 conference->guid = g_strdup(BLANK_GUID);
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205 void
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 nm_conference_set_data(NMConference * conference, gpointer data)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 return;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 conference->data = data;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 gpointer
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 nm_conference_get_data(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 return NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 return conference->data;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 }
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 const char *
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 nm_conference_get_guid(NMConference * conference)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 {
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 if (conference == NULL)
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 return NULL;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 return conference->guid;
9ee2542d1104 [gaim-migrate @ 9428]
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 }