diff options
author | Michal Kubecek <mkubecek@suse.cz> | 2015-04-13 09:21:39 +0200 |
---|---|---|
committer | Michal Kubecek <mkubecek@suse.cz> | 2015-04-13 09:21:39 +0200 |
commit | e2bc6f4153813cc570ae814c8ddb74628009b488 (patch) | |
tree | a40b171be1d859c2232ccc94f758010f9ae54d3c /src/im/im_iscomposing_body.h | |
download | twinkle-e2bc6f4153813cc570ae814c8ddb74628009b488.tar twinkle-e2bc6f4153813cc570ae814c8ddb74628009b488.tar.gz twinkle-e2bc6f4153813cc570ae814c8ddb74628009b488.tar.lz twinkle-e2bc6f4153813cc570ae814c8ddb74628009b488.tar.xz twinkle-e2bc6f4153813cc570ae814c8ddb74628009b488.zip |
initial checkin
Check in contents of upstream 1.4.2 tarball, exclude generated files.
Diffstat (limited to 'src/im/im_iscomposing_body.h')
-rw-r--r-- | src/im/im_iscomposing_body.h | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/src/im/im_iscomposing_body.h b/src/im/im_iscomposing_body.h new file mode 100644 index 0000000..57dbe62 --- /dev/null +++ b/src/im/im_iscomposing_body.h @@ -0,0 +1,89 @@ +/* + Copyright (C) 2005-2009 Michel de Boer <michel@twinklephone.com> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/** + * @file + * RFC 3994 im-iscomposing+xml body + */ + +#ifndef _IM_ISCOMPOSING_BODY_H +#define _IM_ISCOMPOSING_BODY_H + +#include <string> +#include <time.h> +#include <libxml/tree.h> +#include "parser/sip_body.h" + +using namespace std; + +//@{ +/** @name Message composition states */ +#define IM_ISCOMPOSING_STATE_IDLE "idle" +#define IM_ISCOMPOSING_STATE_ACTIVE "active" +//@} + +/** RFC 3994 im-iscomposing+xml body */ +class t_im_iscomposing_xml_body : public t_sip_body_xml { +private: + string state_; /**< Composition state */ + time_t refresh_; /**< Refresh interval in seconds */ + + /** Extract information elements from the XML document. */ + bool extract_data(void); + + /** + * Process the state element. + * @param node [in] The state element. + */ + bool process_node_state(xmlNode *node); + + /** + * Process the refresh element. + * @param node [in] The refresh element. + */ + void process_node_refresh(xmlNode *node); + +protected: + /** + * Create a im-iscomposing document from the values stored in the attributes. + */ + virtual void create_xml_doc(const string &xml_version = "1.0", const string &charset = "UTF-8"); + +public: + /** Constructor */ + t_im_iscomposing_xml_body(); + + virtual t_sip_body *copy(void) const; + virtual t_body_type get_type(void) const; + virtual t_media get_media(void) const; + virtual bool parse(const string &s); + + /** @name Getters */ + //@{ + string get_state(void) const; + time_t get_refresh(void) const; + //@} + + /** @name Setters */ + //@{ + void set_state(const string &state); + void set_refresh(time_t refresh); + //@} +}; + +#endif |