annotate libpurple/disco.c @ 26337:de05bdd931ed

The core should be in charge of setting in_progress to FALSE
author Paul Aurich <paul@darkrain42.org>
date Tue, 31 Mar 2009 05:22:44 +0000
parents c619bef09bec
children d6b2944f04b3
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
1 /**
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
2 * @file disco.c Service Discovery API
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
3 * @ingroup core
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
4 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
5
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
6 /* purple
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
7 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
8 * Purple is the legal property of its developers, whose names are too numerous
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
10 * source distribution.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
11 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
15 * (at your option) any later version.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
16 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
20 * GNU General Public License for more details.
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
21 *
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
25 */
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
26
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
27 #include "internal.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
28 #include "debug.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
29
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
30 #include "disco.h"
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
31
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
32 /**************************************************************************/
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
33 /* Main structures, members and constants */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
34 /**************************************************************************/
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
35
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
36 /**
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
37 * Represents a list of services for a given connection on a given protocol.
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
38 */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
39 struct _PurpleDiscoList {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
40 PurpleAccount *account; /**< The account this list belongs to. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
41 GList *services; /**< The list of services. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
42
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
43 gboolean in_progress;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
44
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
45 gpointer ui_data; /**< UI private data. */
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
46 gpointer proto_data; /**< Prpl private data. */
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
47 PurpleDiscoCloseCallback close_cb; /**< Callback to free the prpl data */
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
48 guint ref; /**< The reference count. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
49 };
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
50
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
51 /**
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
52 * Represents a list of services for a given connection on a given protocol.
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
53 */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
54 struct _PurpleDiscoService {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
55 PurpleDiscoList *list;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
56 gchar *name; /**< The name of the service. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
57 gchar *description; /**< The name of the service. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
58
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
59 PurpleDiscoServiceCategory category; /**< The category of service. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
60 PurpleDiscoServiceType type; /**< The type of service. */
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
61 PurpleDiscoServiceFlags flags;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
62 };
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
63
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
64 static PurpleDiscoUiOps *ops = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
65
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
66 PurpleDiscoList *purple_disco_list_new(PurpleAccount *account)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
67 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
68 PurpleDiscoList *list;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
69
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
70 g_return_val_if_fail(account != NULL, NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
71
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
72 list = g_new0(PurpleDiscoList, 1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
73 list->account = account;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
74 list->ref = 1;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
75
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
76 if (ops && ops->create)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
77 ops->create(list);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
78
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
79 return list;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
80 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
81
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
82 PurpleDiscoList *purple_disco_list_ref(PurpleDiscoList *list)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
83 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
84 g_return_val_if_fail(list != NULL, NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
85
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
86 list->ref++;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
87 purple_debug_misc("disco", "reffing list, ref count now %d\n", list->ref);
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
88
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
89 return list;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
90 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
91
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
92 static void purple_disco_list_service_destroy(PurpleDiscoList *list, PurpleDiscoService *r)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
93 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
94 g_free(r->name);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
95 g_free(r->description);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
96 g_free(r);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
97 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
98
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
99 static void purple_disco_list_destroy(PurpleDiscoList *list)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
100 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
101 GList *l;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
102
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
103 purple_debug_misc("disco", "destroying list %p\n", list);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
104
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
105 if (ops && ops->destroy)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
106 ops->destroy(list);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
107
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
108 if (list->close_cb)
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
109 list->close_cb(list);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
110
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
111 for (l = list->services; l; l = l->next) {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
112 PurpleDiscoService *s = l->data;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
113 purple_disco_list_service_destroy(list, s);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
114 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
115 g_list_free(list->services);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
116
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
117 g_free(list);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
118 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
119
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
120 void purple_disco_list_unref(PurpleDiscoList *list)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
121 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
122 g_return_if_fail(list != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
123 g_return_if_fail(list->ref > 0);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
124
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
125 list->ref--;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
126
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
127 purple_debug_misc("disco", "unreffing list, ref count now %d\n", list->ref);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
128 if (list->ref == 0)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
129 purple_disco_list_destroy(list);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
130 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
131
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
132 void purple_disco_list_service_add(PurpleDiscoList *list, PurpleDiscoService *service, PurpleDiscoService *parent)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
133 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
134 g_return_if_fail(list != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
135 g_return_if_fail(service != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
136
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
137 list->services = g_list_append(list->services, service);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
138 service->list = list;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
139
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
140 if (ops && ops->add_service)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
141 ops->add_service(list, service, parent);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
142 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
143
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
144 PurpleDiscoService *purple_disco_list_service_new(PurpleDiscoServiceCategory category, const gchar *name,
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
145 PurpleDiscoServiceType type, const gchar *description, PurpleDiscoServiceFlags flags)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
146 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
147 PurpleDiscoService *s;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
148
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
149 g_return_val_if_fail(name != NULL, NULL);
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
150 g_return_val_if_fail(category != PURPLE_DISCO_SERVICE_CAT_UNSET, NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
151
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
152 s = g_new0(PurpleDiscoService, 1);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
153 s->category = category;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
154 s->name = g_strdup(name);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
155 s->type = type;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
156 s->description = g_strdup(description);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
157 s->flags = flags;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
158
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
159 return s;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
160 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
161
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
162 PurpleDiscoList *purple_disco_get_list(PurpleConnection *pc)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
163 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
164 PurplePlugin *prpl = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
165 PurplePluginProtocolInfo *prpl_info = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
166
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
167 g_return_val_if_fail(pc != NULL, NULL);
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
168
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
169 prpl = purple_connection_get_prpl(pc);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
170 if (prpl != NULL)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
171 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
172
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
173 if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, disco_get_list))
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
174 return prpl_info->disco_get_list(pc);
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
175
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
176 return NULL;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
177 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
178
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
179 void purple_disco_cancel_get_list(PurpleDiscoList *list)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
180 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
181 PurplePlugin *prpl = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
182 PurplePluginProtocolInfo *prpl_info = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
183 PurpleConnection *gc;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
184
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
185 g_return_if_fail(list != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
186
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
187 gc = purple_account_get_connection(list->account);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
188
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
189 g_return_if_fail(gc != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
190
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
191 if (gc)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
192 prpl = purple_connection_get_prpl(gc);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
193
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
194 if (prpl)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
195 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
196
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
197 if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, disco_cancel))
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
198 prpl_info->disco_cancel(list);
26337
de05bdd931ed The core should be in charge of setting in_progress to FALSE
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
199
de05bdd931ed The core should be in charge of setting in_progress to FALSE
Paul Aurich <paul@darkrain42.org>
parents: 26336
diff changeset
200 purple_disco_list_set_in_progress(list, FALSE);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
201 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
202
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
203 void purple_disco_service_register(PurpleDiscoService *service)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
204 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
205 PurpleConnection *pc;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
206 PurplePlugin *prpl = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
207 PurplePluginProtocolInfo *prpl_info = NULL;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
208
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
209 g_return_if_fail(service != NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
210
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
211 pc = purple_account_get_connection(service->list->account);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
212
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
213 g_return_if_fail(pc != NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
214
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
215 prpl = purple_connection_get_prpl(pc);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
216
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
217 if (prpl != NULL)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
218 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
219
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
220 if (prpl_info && PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, disco_service_register))
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
221 prpl_info->disco_service_register(pc, service);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
222 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
223
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
224 const gchar *purple_disco_service_get_name(PurpleDiscoService *service)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
225 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
226 g_return_val_if_fail(service != NULL, NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
227
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
228 return service->name;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
229 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
230
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
231 const gchar *purple_disco_service_get_description(PurpleDiscoService *service)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
232 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
233 g_return_val_if_fail(service != NULL, NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
234
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
235 return service->description;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
236 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
237
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
238 PurpleDiscoServiceCategory
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
239 purple_disco_service_get_category(PurpleDiscoService *service)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
240 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
241 g_return_val_if_fail(service != NULL, PURPLE_DISCO_SERVICE_CAT_UNSET);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
242
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
243 return service->category;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
244 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
245
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
246 PurpleDiscoServiceType
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
247 purple_disco_service_get_type(PurpleDiscoService *service)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
248 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
249 g_return_val_if_fail(service != NULL, PURPLE_DISCO_SERVICE_TYPE_NONE);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
250
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
251 return service->type;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
252 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
253
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
254 PurpleDiscoServiceFlags
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
255 purple_disco_service_get_flags(PurpleDiscoService *service)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
256 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
257 g_return_val_if_fail(service != NULL, PURPLE_DISCO_NONE);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
258
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
259 return service->flags;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
260 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
261
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
262 PurpleAccount* purple_disco_list_get_account(PurpleDiscoList *list)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
263 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
264 g_return_val_if_fail(list != NULL, NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
265
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
266 return list->account;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
267 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
268
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
269 GList* purple_disco_list_get_services(PurpleDiscoList *list)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
270 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
271 g_return_val_if_fail(list != NULL, NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
272
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
273 return list->services;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
274 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
275
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
276 void purple_disco_list_set_ui_data(PurpleDiscoList *list, gpointer ui_data)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
277 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
278 g_return_if_fail(list != NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
279
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
280 list->ui_data = ui_data;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
281 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
282
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
283 gpointer purple_disco_list_get_ui_data(PurpleDiscoList *list)
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
284 {
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
285 g_return_val_if_fail(list != NULL, NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
286
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
287 return list->ui_data;
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
288 }
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
289
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
290 void purple_disco_list_set_in_progress(PurpleDiscoList *list,
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
291 gboolean in_progress)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
292 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
293 g_return_if_fail(list != NULL);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
294
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
295 list->in_progress = in_progress;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
296
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
297 if (ops && ops->in_progress)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
298 ops->in_progress(list, in_progress);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
299 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
300
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
301 gboolean purple_disco_list_get_in_progress(PurpleDiscoList *list)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
302 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
303 g_return_val_if_fail(list != NULL, FALSE);
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
304
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
305 return list->in_progress;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
306 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
307
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
308 void purple_disco_list_set_protocol_data(PurpleDiscoList *list,
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
309 gpointer proto_data,
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
310 PurpleDiscoCloseCallback cb)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
311 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
312 g_return_if_fail(list != NULL);
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
313
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
314 list->proto_data = proto_data;
26336
c619bef09bec Make the prpl be in charge of creating the PurpleDiscoList; UI data is
Paul Aurich <paul@darkrain42.org>
parents: 26334
diff changeset
315 list->close_cb = cb;
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
316 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
317
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
318 gpointer purple_disco_list_get_protocol_data(PurpleDiscoList *list)
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
319 {
26334
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
320 g_return_val_if_fail(list != NULL, NULL);
535c866b433c Hide the structs, add accessors, and fix various smaller things:
Paul Aurich <paul@darkrain42.org>
parents: 26332
diff changeset
321
26331
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
322 return list->proto_data;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
323 }
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
324
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
325 void purple_disco_set_ui_ops(PurpleDiscoUiOps *ui_ops)
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
326 {
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
327 ops = ui_ops;
a5010188c01e Add the files I forgot to `mtn add` earlier (also, alphabetized disco.h
Paul Aurich <paul@darkrain42.org>
parents:
diff changeset
328 }
26332
2efdd76f5dc0 Fix compilation errors and add padding to UI ops. My bad...
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
329
2efdd76f5dc0 Fix compilation errors and add padding to UI ops. My bad...
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
330 PurpleDiscoUiOps *purple_disco_get_ui_ops(void)
2efdd76f5dc0 Fix compilation errors and add padding to UI ops. My bad...
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
331 {
2efdd76f5dc0 Fix compilation errors and add padding to UI ops. My bad...
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
332 return ops;
2efdd76f5dc0 Fix compilation errors and add padding to UI ops. My bad...
Paul Aurich <paul@darkrain42.org>
parents: 26331
diff changeset
333 }