6 * Copyright (C) 2010 SIPE Project <http://sipe.sourceforge.net/>
7 * Copyright (C) 2008 Novell, Inc.
8 * Copyright (C) 2005, Thomas Butter <butter@uni-mannheim.de>
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 * Interface dependencies:
32 int response
; /* 0 means request, otherwise response code */
51 struct sipmsg
*sipmsg_parse_msg(const gchar
*msg
);
52 struct sipmsg
*sipmsg_parse_header(const gchar
*header
);
53 struct sipmsg
*sipmsg_copy(const struct sipmsg
*other
);
54 void sipmsg_add_header_now(struct sipmsg
*msg
, const gchar
*name
, const gchar
*value
);
55 void sipmsg_add_header(struct sipmsg
*msg
, const gchar
*name
, const gchar
*value
);
56 void sipmsg_add_header_now_pos(struct sipmsg
*msg
, const gchar
*name
, const gchar
*value
, int pos
);
57 void sipmsg_strip_headers(struct sipmsg
*msg
, const gchar
*keepers
[]);
58 void sipmsg_merge_new_headers(struct sipmsg
*msg
);
59 void sipmsg_free(struct sipmsg
*msg
);
60 GSList
*sipmsg_parse_endpoints_header(const gchar
*header
);
62 * Parses sip: and tel: URI out of P-Asserted-Identity header from INVITE request.
63 * You must free the values.
66 * P-Asserted-Identity: "Cullen Jennings" <sip:fluffy@cisco.com>
67 * P-Asserted-Identity: tel:+14085264000
68 * P-Asserted-Identity: "Lunch, Lucas" <sip:llucas@cisco.com>,<tel:+420123456;ext=88463>
70 * @param header (in) P-Asserted-Identity header contents
71 * @param sip_uri (out) parsed sip: URI or NULL if missing
72 * @param tel_uri (out) parsed tel: URI or NULL if missing
74 void sipmsg_parse_p_asserted_identity(const gchar
*header
, gchar
**sip_uri
,
76 const gchar
*sipmsg_find_header(const struct sipmsg
*msg
, const gchar
*name
);
77 const gchar
*sipmsg_find_header_instance(const struct sipmsg
*msg
, const gchar
*name
, int which
);
78 gchar
*sipmsg_find_part_of_header(const char *hdr
, const char * before
, const char * after
, const char * def
);
79 gchar
*sipmsg_find_auth_header(struct sipmsg
*msg
, const gchar
*name
);
80 void sipmsg_remove_header_now(struct sipmsg
*msg
, const gchar
*name
);
81 char *sipmsg_to_string(const struct sipmsg
*msg
);
84 * Formats message to html if not yet.
85 * Either - keep as is if text/html, or escape text, or escape text and apply format string if any
87 * @param body in case of 'ms_text_format is Content-Type header' or NULL otherwise
88 * @param ms_text_format either ms-text-format ot Content-Type header.
90 * Allocates memory. Must be feed when done.
92 gchar
*get_html_message(const gchar
*ms_text_format
, const gchar
*body
);
95 * Parses headers-like 'msgr' attribute of INVITE's 'ms_text_format' header.
96 * Then retrieves value of 'X-MMS-IM-Format'.
98 * 'msgr' typically looks like:
99 * X-MMS-IM-Format: FN=Microsoft%20Sans%20Serif; EF=BI; CO=800000; CS=0; PF=22
101 gchar
*sipmsg_get_x_mms_im_format(gchar
*msgr
);
104 * Returns UTF-16LE/'modified base64' encoded X-MMS-IM-Format
105 * based on input x_mms_im_format.
107 gchar
*sipmsg_get_msgr_string(gchar
*x_mms_im_format
);
110 * Translates X-MMS-IM format to HTML presentation.
112 gchar
*sipmsg_apply_x_mms_im_format(const char *x_mms_im_format
, gchar
*body
);
114 #define sipe_parse_html msn_import_html
116 * Parses the Purple message formatting (html) into the MSN format.
118 * @param html The html message to format.
119 * @param attributes The returned attributes string.
120 * @param message The returned message string.
122 * @return The new message.
124 void sipe_parse_html(const char *html
, char **attributes
, char **message
);
126 void msn_parse_format(const char *mime
, char **pre_ret
, char **post_ret
);
127 void msn_import_html(const char *html
, char **attributes
, char **message
);