Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / protocols / jabber / presence.h
blobbafb5dd3274fce05703ae7716f1c133d54839f09
1 /**
2 * @file presence.h Presence
4 * purple
6 * Purple is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 #ifndef PURPLE_JABBER_PRESENCE_H
26 #define PURPLE_JABBER_PRESENCE_H
28 typedef enum {
29 JABBER_PRESENCE_ERROR = -2,
30 JABBER_PRESENCE_PROBE = -1,
31 JABBER_PRESENCE_AVAILABLE,
32 JABBER_PRESENCE_UNAVAILABLE,
33 JABBER_PRESENCE_SUBSCRIBE,
34 JABBER_PRESENCE_SUBSCRIBED,
35 JABBER_PRESENCE_UNSUBSCRIBE,
36 JABBER_PRESENCE_UNSUBSCRIBED
37 } JabberPresenceType;
39 typedef struct _JabberPresenceChatInfo JabberPresenceChatInfo;
40 typedef struct _JabberPresence JabberPresence;
42 #include "buddy.h"
43 #include "chat.h"
44 #include "jabber.h"
45 #include "jutil.h"
46 #include "xmlnode.h"
48 struct _JabberPresenceChatInfo {
49 GSList *codes;
50 PurpleXmlNode *item;
53 struct _JabberPresence {
54 JabberPresenceType type;
55 JabberID *jid_from;
56 const char *from;
57 const char *to;
58 const char *id;
60 JabberBuddy *jb;
61 JabberChat *chat;
62 JabberPresenceChatInfo chat_info;
63 PurpleXmlNode *caps; /* TODO: Temporary, see presence.c:parse_caps */
65 JabberBuddyState state;
66 gchar *status;
67 int priority;
69 char *vcard_avatar_hash;
70 char *nickname;
72 gboolean delayed;
73 time_t sent;
74 int idle;
75 gboolean adjust_idle_for_delay;
78 typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence,
79 PurpleXmlNode *child);
80 void jabber_presence_register_handler(const char *node, const char *xmlns,
81 JabberPresenceHandler *handler);
83 void jabber_presence_init(void);
84 void jabber_presence_uninit(void);
86 void jabber_set_status(PurpleAccount *account, PurpleStatus *status);
88 /**
89 * Send a full presence stanza.
91 * @param js A JabberStream object.
92 * @param force Force sending the presence stanza, irrespective of whether
93 * the contents seem to have changed.
95 void jabber_presence_send(JabberStream *js, gboolean force);
97 PurpleXmlNode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority);
98 void jabber_presence_parse(JabberStream *js, PurpleXmlNode *packet);
99 void jabber_presence_subscription_set(JabberStream *js, const char *who,
100 const char *type);
101 void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status);
102 void purple_status_to_jabber(PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority);
104 #endif /* PURPLE_JABBER_PRESENCE_H */