summaryrefslogtreecommitdiff
path: root/src/connection.h
blob: 0eef9225e1d1342fe34b04a06378038847b26823 (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
#ifndef __HAZE_CONNECTION_H__
#define __HAZE_CONNECTION_H__
/*
 * connection.h - HazeConnection header
 * Copyright (C) 2007 Will Thompson
 * Copyright (C) 2007-2008 Collabora Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include <glib-object.h>
#include <telepathy-glib/telepathy-glib.h>

#include <libpurple/account.h>
#include <libpurple/prpl.h>

#include "contact-list.h"
#include "im-channel-factory.h"

G_BEGIN_DECLS

typedef struct _HazeConnection HazeConnection;
typedef struct _HazeConnectionPrivate HazeConnectionPrivate;
typedef struct _HazeConnectionClass HazeConnectionClass;

struct _HazeConnectionClass {
    TpBaseConnectionClass parent_class;
    TpDBusPropertiesMixinClass properties_class;
    TpContactsMixinClass contacts_class;
    TpPresenceMixinClass presence_class;
};

struct _HazeConnection {
    TpBaseConnection parent;

    PurpleAccount *account;

    HazeContactList *contact_list;
    HazeImChannelFactory *im_factory;
    TpSimplePasswordManager *password_manager;

    TpContactsMixin contacts;
    TpPresenceMixin presence;

    gchar **acceptable_avatar_mime_types;

    HazeConnectionPrivate *priv;
};

#define ACCOUNT_GET_HAZE_CONNECTION(account) \
    (HAZE_CONNECTION ((account)->ui_data))
#define ACCOUNT_GET_TP_BASE_CONNECTION(account) \
    (TP_BASE_CONNECTION ((account)->ui_data))
#define HAZE_CONNECTION_GET_PRPL_INFO(conn) \
    (PURPLE_PLUGIN_PROTOCOL_INFO (conn->account->gc->prpl))

PurpleAccountUiOps *haze_get_account_ui_ops (void);
PurpleConnectionUiOps *haze_get_connection_ui_ops (void);

const gchar *
haze_connection_handle_inspect (HazeConnection *conn,
                                TpHandleType handle_type,
                                TpHandle handle);

gboolean haze_connection_create_account (HazeConnection *self, GError **error);

GType haze_connection_get_type (void);

/* TYPE MACROS */
#define HAZE_TYPE_CONNECTION \
  (haze_connection_get_type ())
#define HAZE_CONNECTION(obj) \
  (G_TYPE_CHECK_INSTANCE_CAST((obj), HAZE_TYPE_CONNECTION, \
                              HazeConnection))
#define HAZE_CONNECTION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_CAST((klass), HAZE_TYPE_CONNECTION, \
                           HazeConnectionClass))
#define HAZE_IS_CONNECTION(obj) \
  (G_TYPE_CHECK_INSTANCE_TYPE((obj), HAZE_TYPE_CONNECTION))
#define HAZE_IS_CONNECTION_CLASS(klass) \
  (G_TYPE_CHECK_CLASS_TYPE((klass), HAZE_TYPE_CONNECTION))
#define HAZE_CONNECTION_GET_CLASS(obj) \
  (G_TYPE_INSTANCE_GET_CLASS ((obj), HAZE_TYPE_CONNECTION, \
                              HazeConnectionClass))

const gchar *haze_get_fallback_group (void);

GPtrArray * haze_connection_dup_implemented_interfaces (
        PurplePluginProtocolInfo *prpl_info);

const gchar **haze_connection_get_guaranteed_interfaces (void);

void haze_connection_request_password (PurpleAccount *account,
                                       gpointer user_data);
void haze_connection_cancel_password_request (PurpleAccount *account);

G_END_DECLS

#endif /* #ifndef __HAZE_CONNECTION_H__*/