telepathygabble/inc/gabble-presence.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /*
       
     2  * gabble-presence.h - Headers for Gabble's per-contact presence structure
       
     3  * Copyright (C) 2005 Collabora Ltd.
       
     4  * 
       
     5  *
       
     6  * This library is free software; you can redistribute it and/or
       
     7  * modify it under the terms of the GNU Lesser General Public
       
     8  * License as published by the Free Software Foundation; either
       
     9  * version 2.1 of the License, or (at your option) any later version.
       
    10  *
       
    11  * This library is distributed in the hope that it will be useful,
       
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14  * Lesser General Public License for more details.
       
    15  *
       
    16  * You should have received a copy of the GNU Lesser General Public
       
    17  * License along with this library; if not, write to the Free Software
       
    18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    19  */
       
    20 
       
    21 
       
    22 #ifndef __GABBLE_PRESENCE_H__
       
    23 #define __GABBLE_PRESENCE_H__
       
    24 
       
    25 #include <glib-object.h>
       
    26 
       
    27 #include "gabble-connection.h"
       
    28 #include "gabble_enums.h"
       
    29 
       
    30 G_BEGIN_DECLS
       
    31 
       
    32 #define GABBLE_TYPE_PRESENCE gabble_presence_get_type()
       
    33 
       
    34 #define GABBLE_PRESENCE(obj) \
       
    35     (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
       
    36                                    GABBLE_TYPE_PRESENCE, GabblePresence))
       
    37 
       
    38 #define GABBLE_PRESENCE_CLASS(klass) \
       
    39     (G_TYPE_CHECK_CLASS_CAST ((klass), \
       
    40                                 GABBLE_TYPE_PRESENCE, GabblePresenceClass))
       
    41 
       
    42 #define GABBLE_IS_PRESENCE(obj) \
       
    43     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
       
    44                                    GABBLE_TYPE_PRESENCE))
       
    45 
       
    46 #define GABBLE_IS_PRESENCE_CLASS(klass) \
       
    47     (G_TYPE_CHECK_CLASS_TYPE ((klass), \
       
    48                                 GABBLE_TYPE_PRESENCE))
       
    49 
       
    50 #define GABBLE_PRESENCE_GET_CLASS(obj) \
       
    51     (G_TYPE_INSTANCE_GET_CLASS ((obj), \
       
    52                                   GABBLE_TYPE_PRESENCE, GabblePresenceClass))
       
    53 /*Moved to gabble_enums.h
       
    54 typedef enum {
       
    55     PRESENCE_CAP_NONE = 0,
       
    56     PRESENCE_CAP_GOOGLE_TRANSPORT_P2P = 1 << 0,
       
    57     PRESENCE_CAP_GOOGLE_VOICE = 1 << 1,
       
    58     PRESENCE_CAP_JINGLE = 1 << 2,
       
    59     PRESENCE_CAP_JINGLE_DESCRIPTION_AUDIO = 1 << 3,
       
    60     PRESENCE_CAP_JINGLE_DESCRIPTION_VIDEO = 1 << 4,
       
    61 } GabblePresenceCapabilities;*/
       
    62 
       
    63 typedef struct _GabblePresence GabblePresence;
       
    64 
       
    65 struct _GabblePresence {
       
    66     GObject parent;
       
    67     GabblePresenceCapabilities caps;
       
    68     GabblePresenceId status;
       
    69     gchar *status_message;
       
    70     gchar *nickname;
       
    71     gchar *avatar_sha1;
       
    72     gboolean keep_unavailable;
       
    73     gpointer priv;
       
    74 };
       
    75 
       
    76 typedef struct _GabblePresenceClass GabblePresenceClass;
       
    77 
       
    78 struct _GabblePresenceClass {
       
    79     GObjectClass parent_class;
       
    80 };
       
    81 
       
    82 IMPORT_C GType gabble_presence_get_type (void);
       
    83 
       
    84 GabblePresence* gabble_presence_new (void);
       
    85 
       
    86 gboolean gabble_presence_update (GabblePresence *presence, const gchar *resource, GabblePresenceId status, const gchar *status_message, gint8 priority);
       
    87 
       
    88 void gabble_presence_set_capabilities (GabblePresence *presence, const gchar *resource, GabblePresenceCapabilities caps, guint serial);
       
    89 
       
    90 const gchar *gabble_presence_pick_resource_by_caps (GabblePresence *presence, GabblePresenceCapabilities caps);
       
    91 
       
    92 gboolean
       
    93 gabble_presence_resource_has_caps (GabblePresence *presence,
       
    94                                    const gchar *resource,
       
    95                                    GabblePresenceCapabilities caps);
       
    96 
       
    97 LmMessage *gabble_presence_as_message (GabblePresence *presence, const gchar *resource);
       
    98 gchar *
       
    99 gabble_presence_dump (GabblePresence *presence);
       
   100 
       
   101 G_END_DECLS
       
   102 
       
   103 #endif /* __GABBLE_PRESENCE_H__ */
       
   104