lightmelody

changeset 710:17145d045199 objectify

started Lm.message
author Mayank Singh <mayanks43@gmail.com>
date Fri, 04 Jan 2013 18:43:14 -0800
parents 81419276ecf2
children d26cbcd29410
files .hgignore src/Message.gs src/Parser.gs vapi/loudmouth.vapi
diffstat 4 files changed, 107 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/.hgignore	Thu Jan 03 19:48:34 2013 +0530
     1.2 +++ b/.hgignore	Fri Jan 04 18:43:14 2013 -0800
     1.3 @@ -6,3 +6,4 @@
     1.4  __pycache__
     1.5  *.orig
     1.6  *.backup
     1.7 +genie.pyc
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/src/Message.gs	Fri Jan 04 18:43:14 2013 -0800
     2.3 @@ -0,0 +1,59 @@
     2.4 +/*
     2.5 + *  LightMelody - Lightweight XMPP/Jingle Client Library
     2.6 + *  Copyright (C) 2012,2013 Copyleft Games Group
     2.7 + *
     2.8 + *  This program is free software; you can redistribute it and/or modify
     2.9 + *  it under the terms of the GNU Affero General Public License as published
    2.10 + *  by the Free Software Foundation, either version 3 of the License, or
    2.11 + *  (at your option) any later version.
    2.12 + *
    2.13 + *  This program is distributed in the hope that it will be useful,
    2.14 + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.16 + *  GNU Affero General Public License for more details.
    2.17 + *
    2.18 + *  You should have received a copy of the GNU Affero General Public License
    2.19 + *  along with this program; if not, see http://www.gnu.org/licenses
    2.20 + *
    2.21 + */
    2.22 +
    2.23 +[indent=4]
    2.24 +
    2.25 +class Lm.MessagePriv
    2.26 +    _type : Lm.MessageType
    2.27 +    _sub_type : Lm.MessageSubType
    2.28 +    
    2.29 +    prop type : Lm.MessageType?
    2.30 +        get
    2.31 +            return _type
    2.32 +        set
    2.33 +            _type = value
    2.34 +    
    2.35 +    prop sub_type : Lm.MessageSubType?
    2.36 +        get
    2.37 +            return _sub_type
    2.38 +        set
    2.39 +            _sub_type = value
    2.40 +
    2.41 +class Lm.Message
    2.42 +    _node : Lm.MessageNode
    2.43 +    _priv : Lm.MessagePriv
    2.44 +    
    2.45 +    prop node : Lm.MessageNode?
    2.46 +        get
    2.47 +            return _node
    2.48 +        set
    2.49 +            _node = value
    2.50 +    
    2.51 +    prop priv : Lm.MessagePriv
    2.52 +        get
    2.53 +            return _priv
    2.54 +        set
    2.55 +            _priv = value
    2.56 +
    2.57 +    def get_type () : Lm.MessageType?    
    2.58 +        return self.priv.type
    2.59 +
    2.60 +    def get_sub_type () : Lm.MessageSubType?
    2.61 +        return self.priv.sub_type        
    2.62 +
     3.1 --- a/src/Parser.gs	Thu Jan 03 19:48:34 2013 +0530
     3.2 +++ b/src/Parser.gs	Fri Jan 04 18:43:14 2013 -0800
     3.3 @@ -70,4 +70,49 @@
     3.4              if ("stream:stream" == node_name) 
     3.5                  self._end_node_cb (context,
     3.6                              "stream:stream")
     3.7 +
     3.8 +
     3.9 +    def parser_end_node_cb (context : MarkupParseContext, 
    3.10 +                            node_name : string?)
    3.11 +        parser : Lm.Parser
    3.12      
    3.13 +        if (parser._cur_node == null) 
    3.14 +            /* FIXME: LM-1 should look at this */
    3.15 +            return
    3.16 +        
    3.17 +        if (parser._cur_node._name == node_name)
    3.18 +            if (node_name == "stream:stream")
    3.19 +                print ("Got an stream:stream end\n")
    3.20 +            return
    3.21 +
    3.22 +        /*if (parser._cur_node == parser._cur_root)
    3.23 +            m = Lm.Message
    3.24 +            
    3.25 +            m = _lm_message_new_from_node (parser->cur_root);
    3.26 +
    3.27 +            if (!m) {
    3.28 +                g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
    3.29 +                       "Couldn't create message: %s\n",
    3.30 +                       parser->cur_root->name);
    3.31 +                return;
    3.32 +            }
    3.33 +
    3.34 +            g_log (LM_LOG_DOMAIN, LM_LOG_LEVEL_PARSER,
    3.35 +                   "Have a new message\n");
    3.36 +            if (parser->function) {
    3.37 +                (* parser->function) (parser, m, parser->user_data);
    3.38 +            }
    3.39 +
    3.40 +            lm_message_unref (m);
    3.41 +            lm_message_node_unref (parser->cur_root);
    3.42 +            
    3.43 +                
    3.44 +            parser->cur_node = parser->cur_root = NULL;
    3.45 +        } else {
    3.46 +            LmMessageNode *tmp_node;
    3.47 +            tmp_node = parser->cur_node;
    3.48 +            parser->cur_node = parser->cur_node->parent;
    3.49 +
    3.50 +            lm_message_node_unref (tmp_node);
    3.51 +        }
    3.52 +    }    */
     4.1 --- a/vapi/loudmouth.vapi	Thu Jan 03 19:48:34 2013 +0530
     4.2 +++ b/vapi/loudmouth.vapi	Fri Jan 04 18:43:14 2013 -0800
     4.3 @@ -19,7 +19,7 @@
     4.4  
     4.5  
     4.6  namespace Lm {
     4.7 -	[CCode (cheader_filename = "loudmouth/loudmouth.h", ref_function = "lm_message_ref", unref_function = "lm_message_unref")]
     4.8 +	/*[CCode (cheader_filename = "loudmouth/loudmouth.h", ref_function = "lm_message_ref", unref_function = "lm_message_unref")]
     4.9  	[Compact]
    4.10  	public class Message {
    4.11  		public Lm.MessageNode node;
    4.12 @@ -30,7 +30,7 @@
    4.13  		public Lm.MessageType get_type ();
    4.14  		[CCode (has_construct_function = false)]
    4.15  		public Message.with_sub_type (string? to, Lm.MessageType type, Lm.MessageSubType sub_type);
    4.16 -	}
    4.17 +	}*/
    4.18  	/*[CCode (cheader_filename = "loudmouth/loudmouth.h", ref_function = "lm_message_node_ref", unref_function = "lm_message_node_unref")]
    4.19  	[Compact]
    4.20  	public class MessageNode {