ews: add autodiscover trigger function
[siplcs.git] / src / core / sipe-ews-autodiscover.c
blob0f86fea27110faf638bc7682b936708eaefe5ec5
1 /**
2 * @file sipe-ews-autodiscover.c
4 * pidgin-sipe
6 * Copyright (C) 2013 SIPE Project <http://sipe.sourceforge.net/>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include <glib.h>
26 #include "sipe-backend.h"
27 #include "sipe-core.h"
28 #include "sipe-core-private.h"
29 #include "sipe-ews-autodiscover.h"
31 struct sipe_ews_autodiscover_cb {
32 sipe_ews_autodiscover_callback *cb;
33 gpointer cb_data;
36 struct sipe_ews_autodiscover {
37 GSList *callbacks;
40 void sipe_ews_autodiscover_start(struct sipe_core_private *sipe_private,
41 sipe_ews_autodiscover_callback *callback,
42 gpointer callback_data)
44 struct sipe_ews_autodiscover *sea = sipe_private->ews_autodiscover;
45 struct sipe_ews_autodiscover_cb *sea_cb = g_new(struct sipe_ews_autodiscover_cb, 1);
46 sea_cb->cb = callback;
47 sea_cb->cb_data = callback_data;
48 sea->callbacks = g_slist_prepend(sea->callbacks, sea_cb);
50 /* @TODO: start state machine */
51 SIPE_DEBUG_INFO_NOFORMAT("sipe_ews_autodiscover_start: triggered...");
54 void sipe_ews_autodiscover_init(struct sipe_core_private *sipe_private)
56 sipe_private->ews_autodiscover = g_new0(struct sipe_ews_autodiscover, 1);
59 void sipe_ews_autodiscover_free(struct sipe_core_private *sipe_private)
61 struct sipe_ews_autodiscover *sea = sipe_private->ews_autodiscover;
62 GSList *entry = sea->callbacks;
64 while (entry) {
65 struct sipe_ews_autodiscover_cb *sea_cb = entry->data;
66 sea_cb->cb(sipe_private, NULL, sea_cb->cb_data);
67 g_free(sea_cb);
68 entry = entry->next;
70 g_slist_free(sea->callbacks);
71 g_free(sea);
75 Local Variables:
76 mode: c
77 c-file-style: "bsd"
78 indent-tabs-mode: t
79 tab-width: 8
80 End: