comparison libpurple/protocols/jabber/presence.h @ 29960:13f320cde14f

jabber: Heavily refactor jabber_presence_parse(). It's still not short enough. This also fixes building (jabber_presence_uninit() snuck in to my previous changes). Anyway, this has been lightly tested, but should be a lot cleaner going forward, hopefully.
author Paul Aurich <paul@darkrain42.org>
date Tue, 09 Mar 2010 22:44:59 +0000
parents c585572e80dd
children 348a933fed78
comparison
equal deleted inserted replaced
29959:93d32ecf3186 29960:13f320cde14f
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 */ 23 */
24 #ifndef PURPLE_JABBER_PRESENCE_H_ 24 #ifndef PURPLE_JABBER_PRESENCE_H_
25 #define PURPLE_JABBER_PRESENCE_H_ 25 #define PURPLE_JABBER_PRESENCE_H_
26 26
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;
37
38 typedef struct _JabberPresenceChatInfo JabberPresenceChatInfo;
39 typedef struct _JabberPresence JabberPresence;
40
27 #include "buddy.h" 41 #include "buddy.h"
42 #include "chat.h"
28 #include "jabber.h" 43 #include "jabber.h"
44 #include "jutil.h"
29 #include "xmlnode.h" 45 #include "xmlnode.h"
46
47 struct _JabberPresenceChatInfo {
48 GSList *codes;
49 xmlnode *item;
50 };
51
52 struct _JabberPresence {
53 JabberPresenceType type;
54 JabberID *jid_from;
55 const char *from;
56 const char *to;
57 const char *id;
58
59 JabberBuddy *jb;
60 JabberChat *chat;
61 JabberPresenceChatInfo chat_info;
62 xmlnode *caps; /* TODO: Temporary, see presence.c:parse_caps */
63
64 JabberBuddyState state;
65 gchar *status;
66 int priority;
67
68 char *vcard_avatar_hash;
69 char *nickname;
70
71 gboolean delayed;
72 time_t sent;
73 int idle;
74 };
75
76 typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence,
77 xmlnode *child);
78 void jabber_presence_register_handler(const char *node, const char *xmlns,
79 JabberPresenceHandler *handler);
80
81 void jabber_presence_init(void);
82 void jabber_presence_uninit(void);
30 83
31 void jabber_set_status(PurpleAccount *account, PurpleStatus *status); 84 void jabber_set_status(PurpleAccount *account, PurpleStatus *status);
32 85
33 /** 86 /**
34 * Send a full presence stanza. 87 * Send a full presence stanza.