Mercurial > pidgin.yaz
comparison libpurple/disco.c @ 26342:d6b2944f04b3
s/category/type/ and s/muc/chat/ in the core and gateway type is a string.
'type' seems a more reasonable name (category and type are fairly specific
XMPP-isms even though this is basically only ever going to be useful
for XMPP).
Changing the gateway type (i.e. prpl identifier) to a string means adding
them doesn't require minor bumps (and sane fallback methods should be
implementable).
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 01 Apr 2009 05:26:25 +0000 |
parents | de05bdd931ed |
children | 1de01f9594c8 |
comparison
equal
deleted
inserted
replaced
26341:9d0bad6f4b0d | 26342:d6b2944f04b3 |
---|---|
54 struct _PurpleDiscoService { | 54 struct _PurpleDiscoService { |
55 PurpleDiscoList *list; | 55 PurpleDiscoList *list; |
56 gchar *name; /**< The name of the service. */ | 56 gchar *name; /**< The name of the service. */ |
57 gchar *description; /**< The name of the service. */ | 57 gchar *description; /**< The name of the service. */ |
58 | 58 |
59 PurpleDiscoServiceCategory category; /**< The category of service. */ | |
60 PurpleDiscoServiceType type; /**< The type of service. */ | 59 PurpleDiscoServiceType type; /**< The type of service. */ |
60 gchar *gateway_type; /**< The type of the gateway service. */ | |
61 PurpleDiscoServiceFlags flags; | 61 PurpleDiscoServiceFlags flags; |
62 }; | 62 }; |
63 | 63 |
64 static PurpleDiscoUiOps *ops = NULL; | 64 static PurpleDiscoUiOps *ops = NULL; |
65 | 65 |
91 | 91 |
92 static void purple_disco_list_service_destroy(PurpleDiscoList *list, PurpleDiscoService *r) | 92 static void purple_disco_list_service_destroy(PurpleDiscoList *list, PurpleDiscoService *r) |
93 { | 93 { |
94 g_free(r->name); | 94 g_free(r->name); |
95 g_free(r->description); | 95 g_free(r->description); |
96 g_free(r->gateway_type); | |
96 g_free(r); | 97 g_free(r); |
97 } | 98 } |
98 | 99 |
99 static void purple_disco_list_destroy(PurpleDiscoList *list) | 100 static void purple_disco_list_destroy(PurpleDiscoList *list) |
100 { | 101 { |
139 | 140 |
140 if (ops && ops->add_service) | 141 if (ops && ops->add_service) |
141 ops->add_service(list, service, parent); | 142 ops->add_service(list, service, parent); |
142 } | 143 } |
143 | 144 |
144 PurpleDiscoService *purple_disco_list_service_new(PurpleDiscoServiceCategory category, const gchar *name, | 145 PurpleDiscoService *purple_disco_list_service_new(PurpleDiscoServiceType type, const gchar *name, |
145 PurpleDiscoServiceType type, const gchar *description, PurpleDiscoServiceFlags flags) | 146 const gchar *description, PurpleDiscoServiceFlags flags) |
146 { | 147 { |
147 PurpleDiscoService *s; | 148 PurpleDiscoService *s; |
148 | 149 |
149 g_return_val_if_fail(name != NULL, NULL); | 150 g_return_val_if_fail(name != NULL, NULL); |
150 g_return_val_if_fail(category != PURPLE_DISCO_SERVICE_CAT_UNSET, NULL); | 151 g_return_val_if_fail(type != PURPLE_DISCO_SERVICE_TYPE_UNSET, NULL); |
151 | 152 |
152 s = g_new0(PurpleDiscoService, 1); | 153 s = g_new0(PurpleDiscoService, 1); |
153 s->category = category; | |
154 s->name = g_strdup(name); | 154 s->name = g_strdup(name); |
155 s->type = type; | 155 s->type = type; |
156 s->description = g_strdup(description); | 156 s->description = g_strdup(description); |
157 s->flags = flags; | 157 s->flags = flags; |
158 | 158 |
233 g_return_val_if_fail(service != NULL, NULL); | 233 g_return_val_if_fail(service != NULL, NULL); |
234 | 234 |
235 return service->description; | 235 return service->description; |
236 } | 236 } |
237 | 237 |
238 PurpleDiscoServiceCategory | |
239 purple_disco_service_get_category(PurpleDiscoService *service) | |
240 { | |
241 g_return_val_if_fail(service != NULL, PURPLE_DISCO_SERVICE_CAT_UNSET); | |
242 | |
243 return service->category; | |
244 } | |
245 | |
246 PurpleDiscoServiceType | 238 PurpleDiscoServiceType |
247 purple_disco_service_get_type(PurpleDiscoService *service) | 239 purple_disco_service_get_type(PurpleDiscoService *service) |
248 { | 240 { |
249 g_return_val_if_fail(service != NULL, PURPLE_DISCO_SERVICE_TYPE_NONE); | 241 g_return_val_if_fail(service != NULL, PURPLE_DISCO_SERVICE_TYPE_UNSET); |
250 | 242 |
251 return service->type; | 243 return service->type; |
252 } | 244 } |
253 | 245 |
254 PurpleDiscoServiceFlags | 246 PurpleDiscoServiceFlags |
255 purple_disco_service_get_flags(PurpleDiscoService *service) | 247 purple_disco_service_get_flags(PurpleDiscoService *service) |
256 { | 248 { |
257 g_return_val_if_fail(service != NULL, PURPLE_DISCO_NONE); | 249 g_return_val_if_fail(service != NULL, PURPLE_DISCO_NONE); |
258 | 250 |
259 return service->flags; | 251 return service->flags; |
252 } | |
253 | |
254 void purple_disco_service_set_gateway_type(PurpleDiscoService *service, const gchar *type) | |
255 { | |
256 g_return_if_fail(service != NULL); | |
257 | |
258 g_free(service->gateway_type); | |
259 service->gateway_type = g_strdup(type); | |
260 } | |
261 | |
262 const gchar *purple_disco_service_get_gateway_type(PurpleDiscoService *service) | |
263 { | |
264 g_return_val_if_fail(service != NULL, NULL); | |
265 | |
266 return service->gateway_type; | |
260 } | 267 } |
261 | 268 |
262 PurpleAccount* purple_disco_list_get_account(PurpleDiscoList *list) | 269 PurpleAccount* purple_disco_list_get_account(PurpleDiscoList *list) |
263 { | 270 { |
264 g_return_val_if_fail(list != NULL, NULL); | 271 g_return_val_if_fail(list != NULL, NULL); |