Frameworks/libpurple.framework/Versions/2.10.12r8d2874a79747/Headers/jutil.h
branchadium-1.5.11-merge
changeset 6013 f8d0dc659e3f
parent 5941 307f53385811
parent 6012 200a01709ba4
child 6014 fcb71cb71a3d
child 6015 2b01cc935b7c
equal deleted inserted replaced
5941:307f53385811 6013:f8d0dc659e3f
     1 /**
       
     2  * @file jutil.h utility functions
       
     3  *
       
     4  * purple
       
     5  *
       
     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.
       
     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
       
    22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
       
    23  */
       
    24 #ifndef PURPLE_JABBER_JUTIL_H_
       
    25 #define PURPLE_JABBER_JUTIL_H_
       
    26 
       
    27 typedef struct _JabberID {
       
    28 	char *node;
       
    29 	char *domain;
       
    30 	char *resource;
       
    31 } JabberID;
       
    32 
       
    33 typedef enum {
       
    34 	JABBER_BUDDY_STATE_UNKNOWN = -2,
       
    35 	JABBER_BUDDY_STATE_ERROR = -1,
       
    36 	JABBER_BUDDY_STATE_UNAVAILABLE = 0,
       
    37 	JABBER_BUDDY_STATE_ONLINE,
       
    38 	JABBER_BUDDY_STATE_CHAT,
       
    39 	JABBER_BUDDY_STATE_AWAY,
       
    40 	JABBER_BUDDY_STATE_XA,
       
    41 	JABBER_BUDDY_STATE_DND
       
    42 } JabberBuddyState;
       
    43 
       
    44 #include "jabber.h"
       
    45 
       
    46 JabberID* jabber_id_new(const char *str);
       
    47 
       
    48 /**
       
    49  * Compare two JIDs for equality. In addition to the node and domain,
       
    50  * the resources of the two JIDs must also be equal (or both absent).
       
    51  */
       
    52 gboolean jabber_id_equal(const JabberID *jid1, const JabberID *jid2);
       
    53 
       
    54 void jabber_id_free(JabberID *jid);
       
    55 
       
    56 char *jabber_get_domain(const char *jid);
       
    57 char *jabber_get_resource(const char *jid);
       
    58 char *jabber_get_bare_jid(const char *jid);
       
    59 char *jabber_id_get_bare_jid(const JabberID *jid);
       
    60 char *jabber_id_get_full_jid(const JabberID *jid);
       
    61 JabberID *jabber_id_to_bare_jid(const JabberID *jid);
       
    62 
       
    63 gboolean jabber_jid_is_domain(const char *jid);
       
    64 
       
    65 const char *jabber_normalize(const PurpleAccount *account, const char *in);
       
    66 
       
    67 /* Returns true if JID is the bare JID of our server. */
       
    68 gboolean jabber_is_own_server(JabberStream *js, const char *jid);
       
    69 
       
    70 /* Returns true if JID is the bare JID of our account. */
       
    71 gboolean jabber_is_own_account(JabberStream *js, const char *jid);
       
    72 
       
    73 gboolean jabber_nodeprep_validate(const char *);
       
    74 gboolean jabber_domain_validate(const char *);
       
    75 gboolean jabber_resourceprep_validate(const char *);
       
    76 
       
    77 /**
       
    78  * Apply the SASLprep profile of stringprep to the string passed in.
       
    79  *
       
    80  * @returns A newly allocated string containing the normalized version
       
    81  *          of the input, or NULL if an error occurred (the string could
       
    82  *          not be normalized)
       
    83  */
       
    84 char *jabber_saslprep(const char *);
       
    85 
       
    86 /* state -> readable name */
       
    87 const char *jabber_buddy_state_get_name(JabberBuddyState state);
       
    88 /* state -> core id */
       
    89 const char *jabber_buddy_state_get_status_id(JabberBuddyState state);
       
    90 /* state -> show attr (for presence stanza) */
       
    91 const char *jabber_buddy_state_get_show(JabberBuddyState state);
       
    92 /* core id -> state */
       
    93 JabberBuddyState jabber_buddy_status_id_get_state(const char *id);
       
    94 /* show attr (presence stanza) -> state */
       
    95 JabberBuddyState jabber_buddy_show_get_state(const char *id);
       
    96 
       
    97 char *jabber_calculate_data_hash(gconstpointer data, size_t len,
       
    98     const gchar *hash_algo);
       
    99 #endif /* PURPLE_JABBER_JUTIL_H_ */