summaryrefslogtreecommitdiff
path: root/telepathy-glib/connection-internal.h
blob: 6e3c3b5b20c79b4b455e102cf055d1a7cce1a0d8 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
 * TpConnection - proxy for a Telepathy connection (internals)
 *
 * Copyright (C) 2008 Collabora Ltd. <http://www.collabora.co.uk/>
 * Copyright (C) 2008 Nokia Corporation
 *
 * 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
 */

#ifndef TP_CONNECTION_INTERNAL_H
#define TP_CONNECTION_INTERNAL_H

#include <telepathy-glib/capabilities.h>
#include <telepathy-glib/connection.h>
#include <telepathy-glib/contact.h>
#include <telepathy-glib/intset.h>

G_BEGIN_DECLS

typedef void (*TpConnectionProc) (TpConnection *self);

struct _TpConnectionPrivate {
    TpAccount *account;

    /* list of TpConnectionProc */
    GList *introspect_needed;

    gchar *cm_name;
    gchar *proto_name;

    TpHandle last_known_self_handle;
    TpContact *self_contact;
    TpConnectionStatus status;
    TpConnectionStatusReason status_reason;
    gchar *connection_error;
    /* a TP_HASH_TYPE_STRING_VARIANT_MAP */
    GHashTable *connection_error_details;

    /* GArray of GQuark */
    GArray *contact_attribute_interfaces;

    /* items are GQuarks that represent arguments to
     * Connection.AddClientInterests */
    TpIntSet *interests;

    /* TpHandle => weak ref to TpContact */
    GHashTable *contacts;

    TpCapabilities *capabilities;

    TpAvatarRequirements *avatar_requirements;
    GArray *avatar_request_queue;
    guint avatar_request_idle_id;

    TpContactInfoFlags contact_info_flags;
    GList *contact_info_supported_fields;

    gint balance;
    guint balance_scale;
    gchar *balance_currency;
    gchar *balance_uri;

    /* ContactList properties */
    TpContactListState contact_list_state;
    gboolean contact_list_persists;
    gboolean can_change_contact_list;
    gboolean request_uses_message;
    /* TpHandle => ref to TpContact */
    GHashTable *roster;
    /* Queue of owned ContactsChangedItem */
    GQueue *contacts_changed_queue;
    gboolean roster_fetched;
    gboolean contact_list_properties_fetched;

    /* ContactGroups properties */
    gboolean disjoint_groups;
    TpContactMetadataStorageType group_storage;
    GPtrArray *contact_groups;
    gboolean groups_fetched;

    TpProxyPendingCall *introspection_call;

    unsigned ready:1;
    unsigned ready_enough_for_contacts:1;
    unsigned has_immortal_handles:1;
    unsigned tracking_aliases_changed:1;
    unsigned tracking_avatar_updated:1;
    unsigned tracking_avatar_retrieved:1;
    unsigned tracking_presences_changed:1;
    unsigned tracking_presence_update:1;
    unsigned tracking_location_changed:1;
    unsigned tracking_contact_caps_changed:1;
    unsigned tracking_contact_info_changed:1;
    unsigned introspecting_after_connected:1;
    unsigned tracking_client_types_updated:1;
    unsigned introspecting_self_contact:1;
    unsigned tracking_contacts_changed:1;
    unsigned tracking_contact_groups_changed:1;
};

void _tp_connection_status_reason_to_gerror (TpConnectionStatusReason reason,
    TpConnectionStatus prev_status,
    const gchar **ret_str,
    GError **error);

void _tp_connection_add_contact (TpConnection *self, TpHandle handle,
    TpContact *contact);
void _tp_connection_remove_contact (TpConnection *self, TpHandle handle,
    TpContact *contact);
TpContact *_tp_connection_lookup_contact (TpConnection *self, TpHandle handle);

/* Actually implemented in contact.c, but having a contact-internal header
 * just for this would be overkill */
void _tp_contact_connection_invalidated (TpContact *contact);

void _tp_connection_set_account (TpConnection *self, TpAccount *account);

/* connection-contact-info.c */
void _tp_connection_prepare_contact_info_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data);

TpContactInfoFieldSpec *_tp_contact_info_field_spec_new (const gchar *name,
    GStrv parameters, TpContactInfoFieldFlags flags, guint max);

/* connection-avatars.c */
void _tp_connection_prepare_avatar_requirements_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data);

/* connection-contact-list.c */
void _tp_connection_prepare_contact_list_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data);
void _tp_connection_prepare_contact_groups_async (TpProxy *proxy,
    const TpProxyFeature *feature,
    GAsyncReadyCallback callback,
    gpointer user_data);
void _tp_connection_contacts_changed_queue_free (GQueue *queue);

G_END_DECLS

#endif