1
/* $Id: iscomposing.h 3553 2011-05-05 06:14:19Z nanang $ */
3
* Copyright (C) 2008-2011 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
#ifndef __PJSIP_SIMPLE_ISCOMPOSING_H__
21
#define __PJSIP_SIMPLE_ISCOMPOSING_H__
25
* @brief Support for Indication of Message Composition (RFC 3994)
27
#include <pjsip-simple/types.h>
28
#include <pjlib-util/xml.h>
31
* @defgroup PJSIP_ISCOMPOSING Message Composition Indication (RFC 3994)
32
* @ingroup PJSIP_SIMPLE
33
* @brief Support for Indication of Message Composition (RFC 3994)
36
* This implements message composition indication, as described in
44
* Create XML message with MIME type "application/im-iscomposing+xml"
45
* to indicate the message composition status.
47
* @param pool Pool to allocate memory.
48
* @param is_composing Message composition indication status. Set to
49
* PJ_TRUE (or non-zero) to indicate that application
50
* is currently composing an instant message.
51
* @param lst_actv Optional attribute to indicate time of last
52
* activity. If none is to be specified, the value
53
* MUST be set to NULL.
54
* @param content_tp Optional attribute to indicate the content type of
55
* message being composed. If none is to be specified,
56
* the value MUST be set to NULL.
57
* @param refresh Optional attribute to indicate the interval when
58
* next indication will be sent, only when
59
* is_composing is non-zero. If none is to be
60
* specified, the value MUST be set to -1.
62
* @return An XML message containing the message indication.
63
* NULL will be returned when there's not enough
64
* memory to allocate the message.
66
PJ_DECL(pj_xml_node*) pjsip_iscomposing_create_xml(pj_pool_t *pool,
67
pj_bool_t is_composing,
68
const pj_time_val *lst_actv,
69
const pj_str_t *content_tp,
74
* Create message body with Content-Type "application/im-iscomposing+xml"
75
* to indicate the message composition status.
77
* @param pool Pool to allocate memory.
78
* @param is_composing Message composition indication status. Set to
79
* PJ_TRUE (or non-zero) to indicate that application
80
* is currently composing an instant message.
81
* @param lst_actv Optional attribute to indicate time of last
82
* activity. If none is to be specified, the value
83
* MUST be set to NULL.
84
* @param content_tp Optional attribute to indicate the content type of
85
* message being composed. If none is to be specified,
86
* the value MUST be set to NULL.
87
* @param refresh Optional attribute to indicate the interval when
88
* next indication will be sent, only when
89
* is_composing is non-zero. If none is to be
90
* specified, the value MUST be set to -1.
92
* @return The SIP message body containing XML message
93
* indication. NULL will be returned when there's not
94
* enough memory to allocate the message.
96
PJ_DECL(pjsip_msg_body*) pjsip_iscomposing_create_body( pj_pool_t *pool,
97
pj_bool_t is_composing,
98
const pj_time_val *lst_actv,
99
const pj_str_t *content_tp,
104
* Parse the buffer and return message composition indication in the
107
* @param pool Pool to allocate memory for the parsing process.
108
* @param msg The message to be parsed.
109
* @param len Length of the message.
110
* @param p_is_composing Optional pointer to receive iscomposing status.
111
* @param p_last_active Optional pointer to receive last active attribute.
112
* @param p_content_type Optional pointer to receive content type attribute.
113
* @param p_refresh Optional pointer to receive refresh time.
115
* @return PJ_SUCCESS if message can be successfully parsed.
117
PJ_DECL(pj_status_t) pjsip_iscomposing_parse( pj_pool_t *pool,
120
pj_bool_t *p_is_composing,
121
pj_str_t **p_last_active,
122
pj_str_t **p_content_type,
134
#endif /* __PJSIP_SIMPLE_ISCOMPOSING_H__ */