Migrate certificates, icons, logs to XDG dirs
[pidgin-git.git] / libpurple / protocols / jabber / presence.h
blob9318fff0ca562e14da7e353448905c1bce3e2245
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
24 #ifndef PURPLE_JABBER_PRESENCE_H_
25 #define PURPLE_JABBER_PRESENCE_H_
27 typedef enum {
28 JABBER_PRESENCE_ERROR = -2,
29 JABBER_PRESENCE_PROBE = -1,
30 JABBER_PRESENCE_AVAILABLE,
31 JABBER_PRESENCE_UNAVAILABLE,
32 JABBER_PRESENCE_SUBSCRIBE,
33 JABBER_PRESENCE_SUBSCRIBED,
34 JABBER_PRESENCE_UNSUBSCRIBE,
35 JABBER_PRESENCE_UNSUBSCRIBED
36 } JabberPresenceType;
38 typedef struct _JabberPresenceChatInfo JabberPresenceChatInfo;
39 typedef struct _JabberPresence JabberPresence;
41 #include "buddy.h"
42 #include "chat.h"
43 #include "jabber.h"
44 #include "jutil.h"
45 #include "xmlnode.h"
47 struct _JabberPresenceChatInfo {
48 GSList *codes;
49 PurpleXmlNode *item;
52 struct _JabberPresence {
53 JabberPresenceType type;
54 JabberID *jid_from;
55 const char *from;
56 const char *to;
57 const char *id;
59 JabberBuddy *jb;
60 JabberChat *chat;
61 JabberPresenceChatInfo chat_info;
62 PurpleXmlNode *caps; /* TODO: Temporary, see presence.c:parse_caps */
64 JabberBuddyState state;
65 gchar *status;
66 int priority;
68 char *vcard_avatar_hash;
69 char *nickname;
71 gboolean delayed;
72 time_t sent;
73 int idle;
74 gboolean adjust_idle_for_delay;
77 typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence,
78 PurpleXmlNode *child);
79 void jabber_presence_register_handler(const char *node, const char *xmlns,
80 JabberPresenceHandler *handler);
82 void jabber_presence_init(void);
83 void jabber_presence_uninit(void);
85 void jabber_set_status(PurpleAccount *account, PurpleStatus *status);
87 /**
88 * Send a full presence stanza.
90 * @param js A JabberStream object.
91 * @param force Force sending the presence stanza, irrespective of whether
92 * the contents seem to have changed.
94 void jabber_presence_send(JabberStream *js, gboolean force);
96 PurpleXmlNode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority);
97 void jabber_presence_parse(JabberStream *js, PurpleXmlNode *packet);
98 void jabber_presence_subscription_set(JabberStream *js, const char *who,
99 const char *type);
100 void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status);
101 void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority);
103 #endif /* PURPLE_JABBER_PRESENCE_H_ */