Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
yyh_p #1
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: XmppClient MessageFilter and PresenceFilter do not work
Hi, I'm evaluating your product for my company's .net 4 client.

I've based my test client from your groupchat example on another thread.
I've made some modifications to the sample:

  1. private MucManager mm;
  2. private  Jid _roomJid;
  3. private  XmppClient _xmppClient;
  4. private  string _nickname;
  5.  
  6. public GroupChat()
  7. {
  8.   InitializeComponent();
  9. }
  10.  
  11. public void ConnectToRoom(XmppClient xmppClient, Jid roomJid, string nickname)
  12. {
  13.     _roomJid = roomJid;
  14.     _xmppClient = xmppClient;
  15.     _nickname = nickname;
  16.  
  17.     mm = new MucManager(xmppClient);
  18.  
  19.  
  20.     // Setup new Message Callback using the MessageFilter
  21.     _xmppClient.MessageFilter.Add(roomJid, new BareJidComparer(), MessageCallback);
  22.  
  23.     // Setup new Presence Callback using the PresenceFilter
  24.     _xmppClient.PresenceFilter.Add(roomJid, new BareJidComparer(), PresenceCallback);
  25.  
  26.     if (_roomJid != null)
  27.     {
  28.         mm.EnterRoom(_roomJid, _nickname);                
  29.     }
  30. }

The client is able to log in and join the room without trouble. But, MessageCallback and PresenceCallback are never called.
Is there something wrong with this code?

Thank you
This post was edited 2 times, last on 2015-08-10, 10:33 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no, the code looks fine. Are you creating a new room or joining an existing room?
When you create a new room then you probably have to configure it before you can use it, or create an "instant room" which accepts the default configuration. Post also your Xml logs when possible.

Alex
Avatar
yyh_p #3
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex.

in the test client, I'm joining an existing room.

The roomJid is "testChat566@conference.slim2".

Here are the xml log:

  1. RECV:
  2. <presence id="uvHYV-9" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user2 (ID:5e6a63c937d414621c759337ff2c8338fed2a852)" xmlns="jabber:client">
  3.  <x xmlns="http://jabber.org/protocol/muc#user">
  4.     <item jid="user1@slim2/AHD_5e6a63c937d414621c759337ff2c8338fed2a852" affiliation="owner" role="moderator" />
  5.  </x>
  6. </presence>
  7. RECV:
  8. <presence id="3j3uo-189" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user3" xmlns="jabber:client">
  9.  <status>Online</status>
  10.  <x xmlns="vcard-temp:x:update">
  11.     <photo>d9bfd0282e7b41767e79faca1d70238b</photo>
  12.  </x>
  13.  <x xmlns="jabber:x:avatar">
  14.     <hash>d9bfd0282e7b41767e79faca1d70238b</hash>
  15.  </x>
  16.  <x xmlns="http://jabber.org/protocol/muc#user">
  17.     <item jid="user1@slim2/petrohelpdesk" affiliation="owner" role="moderator" />
  18.  </x>
  19. </presence>
  20. RECV:
  21. <presence to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  22.  <x xmlns="http://jabber.org/protocol/muc#user">
  23.     <item jid="user1@slim2/MatriX" affiliation="owner" role="moderator" />
  24.  </x>
  25. </presence>
  26. RECV:
  27. <message type="groupchat" from="testChat566@conference.slim2" to="user1@slim2/MatriX" xmlns="jabber:client">
  28.  <body>This room is not anonymous.</body>
  29.  <x xmlns="http://jabber.org/protocol/muc#user">
  30.     <status code="100" />
  31.  </x>
  32. </message>
  33. RECV:
  34. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  35.  <body>hijkjkjhjjkjjjjjkkkllliiii</body>
  36.  <x xmlns="jabber:x:delay" stamp="20110802T02:39:14" from="user1@slim2/MatriX" />
  37. </message>
  38. RECV:
  39. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  40.  <body>jjkkkkkkjjk</body>
  41.  <x xmlns="jabber:x:delay" stamp="20110802T02:39:29" from="user1@slim2/MatriX" />
  42. </message>
  43. RECV:
  44. <message id="3j3uo-110" to="user1@slim2/MatriX" type="groupchat" from="testChat566@conference.slim2/user3" xmlns="jabber:client">
  45.  <body>terer</body>
  46.  <x xmlns="jabber:x:event">
  47.     <offline />
  48.     <delivered />
  49.     <displayed />
  50.     <composing />
  51.  </x>
  52.  <x xmlns="jabber:x:delay" stamp="20110802T02:39:42" from="user1@slim2/petrohelpdesk" />
  53. </message>
  54. RECV:
  55. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  56.  <body>abcccccc</body>
  57.  <x xmlns="jabber:x:delay" stamp="20110802T02:39:48" from="user1@slim2/MatriX" />
  58. </message>
  59. RECV:
  60. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  61.  <body>jkkjjkk</body>
  62.  <x xmlns="jabber:x:delay" stamp="20110802T02:40:00" from="user1@slim2/MatriX" />
  63. </message>
  64. RECV:
  65. <message id="VHRkB-0" to="user1@slim2/MatriX" type="groupchat" from="testChat566@conference.slim2/user2 (ID:8454eb9ea35e5d069f2be47e7a0016d677798c1e)" xmlns="jabber:client">
  66.  <body>hello</body>
  67.  <x xmlns="jabber:x:event">
  68.     <offline />
  69.     <delivered />
  70.     <displayed />
  71.  </x>
  72.  <x xmlns="jabber:x:delay" stamp="20110802T02:48:36" from="user1@slim2/AHD_8454eb9ea35e5d069f2be47e7a0016d677798c1e" />
  73. </message>
  74. RECV:
  75. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  76.  <body>helllo abc jjjjj
  77. kkkkk</body>
  78.  <x xmlns="jabber:x:delay" stamp="20110802T03:17:47" from="user1@slim2/MatriX" />
  79. </message>
  80. RECV:
  81. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  82.  <body>hhhhhhhh
  83. jkkjjjjjjjjjjj
  84. jdjfjdsfjdjsdjsfdjsfjsdf</body>
  85.  <x xmlns="jabber:x:delay" stamp="20110802T03:18:19" from="user1@slim2/MatriX" />
  86. </message>
  87. RECV:
  88. <message type="groupchat" to="user1@slim2/MatriX" from="testChat566@conference.slim2/user1" xmlns="jabber:client">
  89.  <body>hi</body>
  90.  <x xmlns="jabber:x:delay" stamp="20110802T03:32:02" from="user1@slim2/MatriX" />
  91. </message>
  92. RECV:
  93. <message id="3j3uo-143" to="user1@slim2/MatriX" type="groupchat" from="testChat566@conference.slim2/user3" xmlns="jabber:client">
  94.  <body>ter4</body>
  95.  <x xmlns="jabber:x:event">
  96.     <offline />
  97.     <delivered />
  98.     <displayed />
  99.     <composing />
  100.  </x>
  101.  <x xmlns="jabber:x:delay" stamp="20110802T03:42:06" from="user1@slim2/petrohelpdesk" />
  102. </message>
  103. RECV:
  104. <message id="VHRkB-1" to="user1@slim2/MatriX" type="groupchat" from="testChat566@conference.slim2/user2 (ID:8454eb9ea35e5d069f2be47e7a0016d677798c1e)" xmlns="jabber:client">
  105.  <body>ter5</body>
  106.  <x xmlns="jabber:x:event">
  107.     <offline />
  108.     <delivered />
  109.     <displayed />
  110.  </x>
  111.  <x xmlns="jabber:x:delay" stamp="20110802T03:42:15" from="user1@slim2/AHD_8454eb9ea35e5d069f2be47e7a0016d677798c1e" />
  112. </message>
  113. RECV:
  114. <message id="3j3uo-195" to="user1@slim2/MatriX" type="groupchat" from="testChat566@conference.slim2/user3" xmlns="jabber:client">
  115.  <body>hellop</body>
  116.  <x xmlns="jabber:x:event">
  117.     <offline />
  118.     <delivered />
  119.     <displayed />
  120.     <composing />
  121.  </x>
  122.  <x xmlns="jabber:x:delay" stamp="20110802T06:08:22" from="user1@slim2/petrohelpdesk" />
  123. </message>
  124. RECV:
  125. <iq id="3j3uo-196" to="user1@slim2/MatriX" type="get" from="testChat566@conference.slim2/user3" xmlns="jabber:client">
  126.  <query xmlns="jabber:iq:version" />
  127. </iq>

As you can see, the test client needs to support both chatstate and the obsolete chat events. Could that be the problem?
This post was edited on 2015-08-10, 10:33 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by yyh_p:
in the test client, I'm joining an existing room.

The roomJid is "testChat566@conference.slim2".

This is not the complete log, the join is missing.
But your Jid can be a problem. The user and domain part should be all lowercase only.
For the Filters testChat566@conference.slim2 and testchat566@conference.slim2 are not the same.

Alex
Avatar
yyh_p #5
Member since Jul 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Thank you for the reply, Alex.

The room Jid was the problem.

It works fine now.
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: