Sun, 21 Mar 2010 19:44:45 +0000
propagate from branch 'im.pidgin.pidgin' (head 2403e9d40e4adfb670121d30d6e9a3528fd098d0)
to branch 'im.pidgin.cpw.malu.ft_thumbnails' (head 619d2b5758c0063fcea00c0896df691302b6b8e6)
| 7014 | 1 | /** |
| 2 | * @file jutil.h utility functions | |
| 3 | * | |
| 15884 | 4 | * purple |
| 7014 | 5 | * |
|
28322
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27898
diff
changeset
|
6 | * Purple is the legal property of its developers, whose names are too numerous |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27898
diff
changeset
|
7 | * to list here. Please refer to the COPYRIGHT file distributed with this |
|
ac8fec1d2234
Remove specific copyright lines from the XMPP prpl.
Paul Aurich <darkrain42@pidgin.im>
parents:
27898
diff
changeset
|
8 | * source distribution. |
| 7014 | 9 | * |
| 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. | |
| 14 | * | |
| 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. | |
| 19 | * | |
| 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
15952
diff
changeset
|
22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 7014 | 23 | */ |
|
26703
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
24 | #ifndef PURPLE_JABBER_JUTIL_H_ |
|
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
25 | #define PURPLE_JABBER_JUTIL_H_ |
| 7014 | 26 | |
| 27 | typedef struct _JabberID { | |
| 28 | char *node; | |
| 29 | char *domain; | |
| 30 | char *resource; | |
| 31 | } JabberID; | |
| 32 | ||
|
29384
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
33 | typedef enum { |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
34 | JABBER_BUDDY_STATE_UNKNOWN = -2, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
35 | JABBER_BUDDY_STATE_ERROR = -1, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
36 | JABBER_BUDDY_STATE_UNAVAILABLE = 0, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
37 | JABBER_BUDDY_STATE_ONLINE, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
38 | JABBER_BUDDY_STATE_CHAT, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
39 | JABBER_BUDDY_STATE_AWAY, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
40 | JABBER_BUDDY_STATE_XA, |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
41 | JABBER_BUDDY_STATE_DND |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
42 | } JabberBuddyState; |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
43 | |
|
27480
7efe4b1ff6a0
I had to make these changes to get "make check" to run
Mark Doliner <markdoliner@pidgin.im>
parents:
27163
diff
changeset
|
44 | #include "jabber.h" |
|
7efe4b1ff6a0
I had to make these changes to get "make check" to run
Mark Doliner <markdoliner@pidgin.im>
parents:
27163
diff
changeset
|
45 | |
| 7014 | 46 | JabberID* jabber_id_new(const char *str); |
| 47 | void jabber_id_free(JabberID *jid); | |
| 48 | ||
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28431
diff
changeset
|
49 | char *jabber_get_domain(const char *jid); |
| 7306 | 50 | char *jabber_get_resource(const char *jid); |
| 7014 | 51 | char *jabber_get_bare_jid(const char *jid); |
|
28431
8450418b5abd
jabber: Properly handle adding buddies that contain a resource. Closes #10151.
Paul Aurich <darkrain42@pidgin.im>
parents:
28322
diff
changeset
|
52 | char *jabber_id_get_bare_jid(const JabberID *jid); |
| 7014 | 53 | |
|
29063
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28431
diff
changeset
|
54 | gboolean jabber_jid_is_domain(const char *jid); |
|
f245c5e9e9f3
jabber: When getting info on a "bare" domain JID, interpret the value of "last"
Marcus Lundblad <malu@pidgin.im>
parents:
28431
diff
changeset
|
55 | |
| 15884 | 56 | const char *jabber_normalize(const PurpleAccount *account, const char *in); |
| 7261 | 57 | |
|
27163
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
58 | /* Returns true if JID is the bare JID of our server. */ |
|
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
59 | gboolean jabber_is_own_server(JabberStream *js, const char *jid); |
|
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
60 | |
|
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
61 | /* Returns true if JID is the bare JID of our account. */ |
|
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
62 | gboolean jabber_is_own_account(JabberStream *js, const char *jid); |
|
398d47149e2f
Add two helper functions useful for matching the 'from' attribute on packets to either our server or our account.
Paul Aurich <darkrain42@pidgin.im>
parents:
26703
diff
changeset
|
63 | |
| 7310 | 64 | gboolean jabber_nodeprep_validate(const char *); |
|
27728
03b2a20ba465
Validate IPv6 identifiers in the domain portion of a JID.
Paul Aurich <darkrain42@pidgin.im>
parents:
27723
diff
changeset
|
65 | gboolean jabber_domain_validate(const char *); |
| 7310 | 66 | gboolean jabber_resourceprep_validate(const char *); |
| 67 | ||
|
29027
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
68 | /** |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
69 | * Apply the SASLprep profile of stringprep to the string passed in. |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
70 | * |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
71 | * @returns A newly allocated string containing the normalized version |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
72 | * of the input, or NULL if an error occurred (the string could |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
73 | * not be normalized) |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
74 | */ |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
75 | char *jabber_saslprep(const char *); |
|
6af29b140195
jabber: Add SASLprep and the username substitution called for in draft-ietf-sasl-scram-10 5.1.
Paul Aurich <darkrain42@pidgin.im>
parents:
28431
diff
changeset
|
76 | |
|
29384
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
77 | /* state -> readable name */ |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
78 | const char *jabber_buddy_state_get_name(JabberBuddyState state); |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
79 | /* state -> core id */ |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
80 | const char *jabber_buddy_state_get_status_id(JabberBuddyState state); |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
81 | /* state -> show attr (for presence stanza) */ |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
82 | const char *jabber_buddy_state_get_show(JabberBuddyState state); |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
83 | /* core id -> state */ |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
84 | JabberBuddyState jabber_buddy_status_id_get_state(const char *id); |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
85 | /* show attr (presence stanza) -> state */ |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
86 | JabberBuddyState jabber_buddy_show_get_state(const char *id); |
|
b7b6be8f77fd
jabber: Move those functions to jutil.[ch]
Paul Aurich <darkrain42@pidgin.im>
parents:
29336
diff
changeset
|
87 | |
|
25110
40b3fffdb00b
Fix up the XMPP User Avatar SHA1 hashing so that we don't mess up the checksum
Paul Aurich <darkrain42@pidgin.im>
parents:
20179
diff
changeset
|
88 | char *jabber_calculate_data_sha1sum(gconstpointer data, size_t len); |
|
26703
17f9a4bef2a3
Further standardize the sentinel style (did someone say leading _s are theoretically a reserved namespace?)
Paul Aurich <darkrain42@pidgin.im>
parents:
25110
diff
changeset
|
89 | #endif /* PURPLE_JABBER_JUTIL_H_ */ |