summaryrefslogtreecommitdiff
path: root/src/dummy-discovery-client.c
blob: 5399f260eecfeb2d97194543475a72025fecd96f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
 * dummy-discovery-client.c - Source for SalutDummyDiscoveryClient
 * Copyright (C) 2007 Collabora Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include "config.h"
#include "dummy-discovery-client.h"

#define DEBUG_FLAG DEBUG_DISCOVERY
#include "debug.h"

static void
discovery_client_init (gpointer g_iface, gpointer iface_data);

G_DEFINE_TYPE_WITH_CODE (SalutDummyDiscoveryClient,
    salut_dummy_discovery_client,
    G_TYPE_OBJECT,
    G_IMPLEMENT_INTERFACE (SALUT_TYPE_DISCOVERY_CLIENT,
      discovery_client_init));

/* signals */
enum
{
  STATE_CHANGED,
  LAST_SIGNAL
};

/* properties */
enum
{
  PROP_STATE = 1,
  LAST_PROPERTY
};

typedef struct _SalutDummyDiscoveryClientPrivate \
          SalutDummyDiscoveryClientPrivate;
struct _SalutDummyDiscoveryClientPrivate
{
  SalutDiscoveryClientState state;

  gboolean dispose_has_run;
};

#define SALUT_DUMMY_DISCOVERY_CLIENT_GET_PRIVATE(obj) \
    ((SalutDummyDiscoveryClientPrivate *) \
      ((SalutDummyDiscoveryClient *) obj)->priv)

static void
salut_dummy_discovery_client_init (SalutDummyDiscoveryClient *self)
{
  SalutDummyDiscoveryClientPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
      SALUT_TYPE_DUMMY_DISCOVERY_CLIENT, SalutDummyDiscoveryClientPrivate);

  self->priv = priv;
  priv->dispose_has_run = FALSE;

  priv->state = SALUT_DISCOVERY_CLIENT_STATE_DISCONNECTED;
}

static void
salut_dummy_discovery_client_dispose (GObject *object)
{
  SalutDummyDiscoveryClient *self = SALUT_DUMMY_DISCOVERY_CLIENT (object);
  SalutDummyDiscoveryClientPrivate *priv =
    SALUT_DUMMY_DISCOVERY_CLIENT_GET_PRIVATE (self);

  if (priv->dispose_has_run)
    return;

  priv->dispose_has_run = TRUE;

  G_OBJECT_CLASS (salut_dummy_discovery_client_parent_class)->dispose (object);
}

static void
salut_dummy_discovery_client_class_init (
    SalutDummyDiscoveryClientClass *salut_dummy_discovery_client_class)
{
  GObjectClass *object_class = G_OBJECT_CLASS (
      salut_dummy_discovery_client_class);

  g_type_class_add_private (salut_dummy_discovery_client_class,
      sizeof (SalutDummyDiscoveryClientPrivate));

  object_class->dispose = salut_dummy_discovery_client_dispose;
}

/*
 * salut_dummy_discovery_client_create_self
 *
 * Implements salut_discovery_client_create_self on SalutDiscoveryClient
 */
static SalutSelf *
salut_dummy_discovery_client_create_self (SalutDiscoveryClient *client,
                                          SalutConnection *connection,
                                          const gchar *nickname,
                                          const gchar *first_name,
                                          const gchar *last_name,
                                          const gchar *jid,
                                          const gchar *email,
                                          const gchar *published_name,
                                          const GArray *olpc_key,
                                          const gchar *olpc_color)
{
  return NULL;
}

static void
discovery_client_init (gpointer g_iface,
                       gpointer iface_data)
{
  SalutDiscoveryClientClass *klass = (SalutDiscoveryClientClass *) g_iface;

  klass->start = NULL;
  klass->create_muc_manager = NULL;
  klass->create_contact_manager = NULL;
#ifdef ENABLE_OLPC
  klass->create_olpc_activity_manager = NULL;
#endif
  klass->create_self = salut_dummy_discovery_client_create_self;
}