1
/* $Id: iscomposing.h 2394 2008-12-23 17:27:53Z bennylp $ */
3
* Copyright (C) 2008-2009 Teluu Inc. (http://www.teluu.com)
4
* Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
* Additional permission under GNU GPL version 3 section 7:
22
* If you modify this program, or any covered work, by linking or
23
* combining it with the OpenSSL project's OpenSSL library (or a
24
* modified version of that library), containing parts covered by the
25
* terms of the OpenSSL or SSLeay licenses, Teluu Inc. (http://www.teluu.com)
26
* grants you additional permission to convey the resulting work.
27
* Corresponding Source for a non-source form of such a combination
28
* shall include the source code for the parts of OpenSSL used as well
29
* as that of the covered work.
31
#ifndef __PJSIP_SIMPLE_ISCOMPOSING_H__
32
#define __PJSIP_SIMPLE_ISCOMPOSING_H__
36
* @brief Support for Indication of Message Composition (RFC 3994)
38
#include <pjsip-simple/types.h>
39
#include <pjlib-util/xml.h>
42
* @defgroup PJSIP_ISCOMPOSING Message Composition Indication (RFC 3994)
43
* @ingroup PJSIP_SIMPLE
44
* @brief Support for Indication of Message Composition (RFC 3994)
47
* This implements message composition indication, as described in
55
* Create XML message with MIME type "application/im-iscomposing+xml"
56
* to indicate the message composition status.
58
* @param pool Pool to allocate memory.
59
* @param is_composing Message composition indication status. Set to
60
* PJ_TRUE (or non-zero) to indicate that application
61
* is currently composing an instant message.
62
* @param lst_actv Optional attribute to indicate time of last
63
* activity. If none is to be specified, the value
64
* MUST be set to NULL.
65
* @param content_tp Optional attribute to indicate the content type of
66
* message being composed. If none is to be specified,
67
* the value MUST be set to NULL.
68
* @param refresh Optional attribute to indicate the interval when
69
* next indication will be sent, only when
70
* is_composing is non-zero. If none is to be
71
* specified, the value MUST be set to -1.
73
* @return An XML message containing the message indication.
74
* NULL will be returned when there's not enough
75
* memory to allocate the message.
77
PJ_DECL(pj_xml_node*) pjsip_iscomposing_create_xml(pj_pool_t *pool,
78
pj_bool_t is_composing,
79
const pj_time_val *lst_actv,
80
const pj_str_t *content_tp,
85
* Create message body with Content-Type "application/im-iscomposing+xml"
86
* to indicate the message composition status.
88
* @param pool Pool to allocate memory.
89
* @param is_composing Message composition indication status. Set to
90
* PJ_TRUE (or non-zero) to indicate that application
91
* is currently composing an instant message.
92
* @param lst_actv Optional attribute to indicate time of last
93
* activity. If none is to be specified, the value
94
* MUST be set to NULL.
95
* @param content_tp Optional attribute to indicate the content type of
96
* message being composed. If none is to be specified,
97
* the value MUST be set to NULL.
98
* @param refresh Optional attribute to indicate the interval when
99
* next indication will be sent, only when
100
* is_composing is non-zero. If none is to be
101
* specified, the value MUST be set to -1.
103
* @return The SIP message body containing XML message
104
* indication. NULL will be returned when there's not
105
* enough memory to allocate the message.
107
PJ_DECL(pjsip_msg_body*) pjsip_iscomposing_create_body( pj_pool_t *pool,
108
pj_bool_t is_composing,
109
const pj_time_val *lst_actv,
110
const pj_str_t *content_tp,
115
* Parse the buffer and return message composition indication in the
118
* @param pool Pool to allocate memory for the parsing process.
119
* @param msg The message to be parsed.
120
* @param len Length of the message.
121
* @param p_is_composing Optional pointer to receive iscomposing status.
122
* @param p_last_active Optional pointer to receive last active attribute.
123
* @param p_content_type Optional pointer to receive content type attribute.
124
* @param p_refresh Optional pointer to receive refresh time.
126
* @return PJ_SUCCESS if message can be successfully parsed.
128
PJ_DECL(pj_status_t) pjsip_iscomposing_parse( pj_pool_t *pool,
131
pj_bool_t *p_is_composing,
132
pj_str_t **p_last_active,
133
pj_str_t **p_content_type,
145
#endif /* __PJSIP_SIMPLE_ISCOMPOSING_H__ */