Updated to release 1.7.0
[siplcs.git] / src / sipe-utils.h
blob900e53bd261d24165f38421e7431cb80a196e15a
1 /**
2 * @file sipe-utils.h
4 * pidgin-sipe
6 * Copyright (C) 2009 SIPE Project <http://sipe.sourceforge.net/>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 /**
24 * Returns epid value.
25 * Uses cache.
26 */
27 gchar *
28 get_epid(struct sipe_account_data *sip);
30 /**
31 * Generate Call ID
33 * @return Call ID. Must be g_free()'d.
35 gchar *gencallid(void);
37 /**
38 * Generate Tag
40 * @return Tag. Must be g_free()'d.
42 gchar *gentag(void);
44 /**
45 * Generate conference-id
46 * 32 characters long. Value space is restricted to printable ASCII characters
48 * Ex.: 8386E6AEAAA41E4AA6627BA76D43B6D1
50 * @return conference-id. Must be g_free()'d.
52 gchar *genconfid(void);
54 /**
55 * Returns instance value for particular publication type.
56 * It should be consistent for the same endpoint
57 * but different between distinct endpoints.
59 * See defined constants for keys patterned SIPE_PUB_*
60 */
61 guint
62 sipe_get_pub_instance(struct sipe_account_data *sip,
63 const char *publication_key);
65 /**
66 * Get contact information from SIPE account
68 * @param sip (in) SIPE account
70 * @return Contact. Must be g_free()'d.
72 gchar *get_contact(const struct sipe_account_data *sip);
74 /**
75 * Parses URI from SIP header
77 * @param hdr (in) To/From header
79 * @return URI with sip: prefix. Must be g_free()'d.
81 gchar *parse_from(const gchar *hdr);
83 /**
84 * Parses CSeq from SIP header
86 * @param hdr (in) CSeqm header
88 * @return int type CSeq value (i.e. without method).
90 int parse_cseq(const gchar *hdr);
92 /**
93 * Create sip: URI from name
95 * @param name (in)
97 * @return URI with sip: prefix. Must be g_free()'d.
99 gchar *sip_uri_from_name(const gchar *name);
102 * Create sip: URI from SIP account user name
104 * @param sip (in) SIP account data
106 * @return URI with sip: prefix. Must be g_free()'d.
108 #define sip_uri_self(sip) (sip_uri_from_name(sip->username))
111 * Create sip: URI from name or sip: URI
113 * @param string (in) name or sip: URI
115 * @return URI with sip: prefix. Must be g_free()'d.
117 gchar *sip_uri(const gchar *string);
120 * Tries to figure out if contact alias which stored locally
121 * is just SIP URI, not a proper display name or local alias.
123 * @param uri SIP URI with 'sip:' prefix.
124 * @param alias as returned by purple.
126 gboolean
127 sipe_is_bad_alias(const char *uri,
128 const char *alias);
131 * Find a XML node from the parent with the specified path
133 * @param parent (in) XML node to start search from
134 * @param ... (in) Names of the descendant nodes
136 * @return descendant XML node
138 xmlnode * xmlnode_get_descendant(const xmlnode *parent, ...);
141 * For glib < 2.8 compatibility
143 char *sipe_get_host_name(void);
146 * Strip white space from the beginning and end of a string
148 * @param b string to be trimmed (may be modified)
150 * @return trimmed string
152 char *trim(char *b);
155 * Checks if provided string is empty - NULL, zero size or just series of white spaces.
156 * Doesn't modify input string.
158 gboolean
159 is_empty(const char *st);