Mercurial > pidgin
annotate libpurple/protocols/jabber/presence.h @ 32819:2c6510167895 default tip
propagate from branch 'im.pidgin.pidgin.2.x.y' (head 3315c5dfbd0ad16511bdcf865e5b07c02d07df24)
to branch 'im.pidgin.pidgin' (head cbd1eda6bcbf0565ae7766396bb8f6f419cb6a9a)
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 02 Jun 2012 02:30:49 +0000 |
parents | 348a933fed78 |
children |
rev | line source |
---|---|
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file presence.h Presence |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
15822 | 4 * purple |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * |
28048
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27497
diff
changeset
|
6 * Purple is the legal property of its developers, whose names are too numerous |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27497
diff
changeset
|
7 * to list here. Please refer to the COPYRIGHT file distributed with this |
c585572e80dd
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <paul@darkrain42.org>
parents:
27497
diff
changeset
|
8 * source distribution. |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * along with this program; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15822
diff
changeset
|
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
24 #ifndef PURPLE_JABBER_PRESENCE_H_ |
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
25 #define PURPLE_JABBER_PRESENCE_H_ |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
29560
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
27 typedef enum { |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
28 JABBER_PRESENCE_ERROR = -2, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
29 JABBER_PRESENCE_PROBE = -1, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
30 JABBER_PRESENCE_AVAILABLE, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
31 JABBER_PRESENCE_UNAVAILABLE, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
32 JABBER_PRESENCE_SUBSCRIBE, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
33 JABBER_PRESENCE_SUBSCRIBED, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
34 JABBER_PRESENCE_UNSUBSCRIBE, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
35 JABBER_PRESENCE_UNSUBSCRIBED |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
36 } JabberPresenceType; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
37 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
38 typedef struct _JabberPresenceChatInfo JabberPresenceChatInfo; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
39 typedef struct _JabberPresence JabberPresence; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
40 |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "buddy.h" |
29560
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
42 #include "chat.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "jabber.h" |
29560
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
44 #include "jutil.h" |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 #include "xmlnode.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
29560
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
47 struct _JabberPresenceChatInfo { |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
48 GSList *codes; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
49 xmlnode *item; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
50 }; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
51 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
52 struct _JabberPresence { |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
53 JabberPresenceType type; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
54 JabberID *jid_from; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
55 const char *from; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
56 const char *to; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
57 const char *id; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
58 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
59 JabberBuddy *jb; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
60 JabberChat *chat; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
61 JabberPresenceChatInfo chat_info; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
62 xmlnode *caps; /* TODO: Temporary, see presence.c:parse_caps */ |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
63 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
64 JabberBuddyState state; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
65 gchar *status; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
66 int priority; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
67 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
68 char *vcard_avatar_hash; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
69 char *nickname; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
70 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
71 gboolean delayed; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
72 time_t sent; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
73 int idle; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
74 }; |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
75 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
76 typedef void (JabberPresenceHandler)(JabberStream *js, JabberPresence *presence, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
77 xmlnode *child); |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
78 void jabber_presence_register_handler(const char *node, const char *xmlns, |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
79 JabberPresenceHandler *handler); |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
80 |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
81 void jabber_presence_init(void); |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
82 void jabber_presence_uninit(void); |
13f320cde14f
jabber: Heavily refactor jabber_presence_parse(). It's still not short enough.
Paul Aurich <paul@darkrain42.org>
parents:
28048
diff
changeset
|
83 |
25147
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
84 void jabber_set_status(PurpleAccount *account, PurpleStatus *status); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
85 |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
86 /** |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
87 * Send a full presence stanza. |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
88 * |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
89 * @param js A JabberStream object. |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
90 * @param force Force sending the presence stanza, irrespective of whether |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
91 * the contents seem to have changed. |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
92 */ |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
93 void jabber_presence_send(JabberStream *js, gboolean force); |
6d6e10476c52
Clean up jabber_presence_send
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
94 |
17836
95affacf6f82
Added the ability to define extensions to caps
Andreas Monitzer <pidgin@monitzer.com>
parents:
15822
diff
changeset
|
95 xmlnode *jabber_presence_create_js(JabberStream *js, JabberBuddyState state, const char *msg, int priority); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 void jabber_presence_parse(JabberStream *js, xmlnode *packet); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 void jabber_presence_subscription_set(JabberStream *js, const char *who, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
98 const char *type); |
27497
9a5a9a4e7626
Simplify the fake_to_self function.
Paul Aurich <paul@darkrain42.org>
parents:
26487
diff
changeset
|
99 void jabber_presence_fake_to_self(JabberStream *js, PurpleStatus *status); |
15822 | 100 void purple_status_to_jabber(const PurpleStatus *status, JabberBuddyState *state, char **msg, int *priority); |
15373
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 |
26481
5767b7698c73
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <paul@darkrain42.org>
parents:
19697
diff
changeset
|
102 #endif /* PURPLE_JABBER_PRESENCE_H_ */ |