Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
yagami #1
Member since Mar 2012 · 30 posts
Group memberships: Members
Show profile · Link to this post
Subject: Extending Matrix
I add a class
  1.    public class MessageStatusEvent : XmppXElement
  2.     {
  3.         public MessageStatusEvent()
  4.             : base("jabber:x:event", "x")
  5.         {
  6.         }
  7.    }
and recieve a message like this
  1. <message xmlns="jabber:client" id="kHcFE-39" to="75214@mobile01.com" from="2128809@mobile01.com/Smack">
  2.  <x xmlns="jabber:x:event">
  3.     <cancelled />
  4.     <id />
  5.  </x>
  6. </message>
I write the code in OnMessage
  1.  var msgStatus = e.Message.Element<MessageStatusEvent>();
  2.                     if (null != msgStatus)
  3.                     {
  4.                        
  5.                     }
But the msgStatus always return null?!why?

Thanks~
This post was edited on 2012-04-02, 11:39 by Alex.
Edit reason: code formatting
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Have you registered your packet in the element factory?

See the tutorial:
  1. private static void RegisterCustomElements()
  2. {
  3.     Factory.RegisterElement<Weather>("ag-software:weather", "weather");
  4. }
Avatar
yagami #3
Member since Mar 2012 · 30 posts
Group memberships: Members
Show profile · Link to this post
Quote by Alex:
Have you registered your packet in the element factory?

See the tutorial:
  1. private static void RegisterCustomElements()
  2. {
  3.     Factory.RegisterElement<Weather>("ag-software:weather", "weather");
  4. }

Oh my god......I forget..
Thanks!!!!
Avatar
yagami #4
Member since Mar 2012 · 30 posts
Group memberships: Members
Show profile · Link to this post
Sorry I have other question.
If My Element is

  1. <x xmlns="jabber:x:delay" from="test.com" stamp="20120412T07:05:30" />

How to write the code?@_@?

  1.     public class CTest: XmppXElement
  2.     {
  3.         public CTest()
  4.             : base("jabber:x:delay", "x")   <- ?
  5.         {
  6.         }
  7.     }

Thx...:)
Avatar
Alex #5
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
yes thats correct. YOu can verify this easy on your own when you do:

  1. Console.WriteLine(new CTest().ToString());

But the class you are looking for already exists:
Matrix.Xmpp.Delay.XDelay

Alex
Avatar
yagami #6
Member since Mar 2012 · 30 posts
Group memberships: Members
Show profile · Link to this post
oh.....I see that...^^"""
Thank you~:)
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: