Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Page:  1  2  next
Avatar
bmurphy #1
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: agsXMPP as a server process
Hi,

I can use agsXMPP successfully to log into an openfire server as a client but I am trying to use it to provide a server gateway function between two seperate IM systems. i.e. MS communicator clients talk to a communicator contact ( which is actually my program) and which logs in and translates to the openfire server in the background.

I have this working to a certain extent for one user but cannot think of how to manage more than one connection at a time with it. The main problem is that for example when logging in the onlogin event fires but I have no way to know which user that event is associated with, in the case where there may be mulitple login requests occuring.

Does anyone have any ideas ? or am I trying to plug a round hole with a square peg ?

thanks
Bernie
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

there are Gateway which translate XMPP messages and presence to other (proprietary) IM systems. E.g. Openfire was a great Gateway plugin for this which supports AIM, ICQ, MSN, YAHOO and IRC. There are also other Gateways available which you can plugin to any server supporting the XMPP component protocol (XEP-0114).

YOu can also write your own gateways (also called components) with agsXMPP and plugin them to your server. You have to use the XmppComponentConnection class. There is also a example in the agsXMPP SDK.

Alex
Avatar
bmurphy #3
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Thank-you Alex,

I have changed my approach to using component connections instead of clients now and have connected successfully being able to send message back and forth. In general terms though how do I manage the discovery of chat rooms and joining etc when using a component connection ? The class does not seem to include the discovery methods that a client connection does ?

Thanks
Bernie
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The DiscoManager can be used only for XmppClientConnections.
But you can use all the other disco classes like the DiscoManager is using them. You could also create your own DiscoManager for component connections, you have to change only some lines of code in DiscoManager.cs.

Alex
Avatar
bmurphy #5
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: component class
Thanks very much Alex I do appreciate the support . .

I have tried to modify DiscoManager.cs and also use directly the functions it calls internally but both cause the problem that DiscoInfo and IQGrabber are not members of the XmppComponentConnection class. How do I make these methods available to me when I am connected to the server as a component and not a client ? Is there any chance you could post a code snippet as example ?

Thanks very much
Bernie
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hi Bernie,

Is it possible that you run into namespace problems?
Component and client connections are in different namespaces. This is why the classes message, iq and presence are also in the agsXMPP.protocol.component namespace. You have to use this classes for your packets. The same applies for the DiscoManager. You have to build the Iqs with agsXMPP.protocol.component.Iq

XmppComponentConnection has also an IqGrabber. Are you running the latest code?

Alex
Avatar
bmurphy #7
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: iqgrabber
Ok, I understand now that I have to be a bit more specific and use message,presence and iq from the component class but I do not see any IQGrabber available in the XmppComponentConnection class. I am using the most recent version 1.00 but only see IQgrabber under the agsXMPP.XmppClientConnection namespace and under agsXMPP namespace directly.

Is there any chance of sample code snippet, showing a discovery query under a component connection ?

Thanks
Avatar
Jabberer #8
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
the latest code with IqGrabber is in the SVN repository.

Let me know which kind of disco you need and we will post a code snippet.
Software Developer
AG-Software
This post was edited on 2012-01-31, 20:02 by Alex.
Avatar
bmurphy #9
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: disco
Hi

thanks much appreciated.

The disco I want to do is to query the conference node for a list of rooms and then join a room.

regards
Bernie
Avatar
Alex #10
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
here is some code for discovering available chatrooms on a server. I created a DiscoItemsIq  helper class which is in the component namespace.

  1. /// <summary>
  2. /// Discovering the Items Associated with a Jabber Entity
  3. /// </summary>
  4. public class DiscoItemsIq : agsXMPP.protocol.component.IQ
  5. {
  6.     private DiscoItems m_DiscoItems = new DiscoItems();
  7.  
  8.     public DiscoItemsIq()
  9.     {
  10.         base.Query = m_DiscoItems;
  11.         this.GenerateId();
  12.     }
  13.  
  14.     public DiscoItemsIq(IqType type) : this()
  15.     {         
  16.         this.Type = type;      
  17.     }   
  18.  
  19.     public new DiscoItems Query
  20.     {
  21.         get
  22.         {
  23.             return m_DiscoItems;
  24.         }
  25.     }
  26. }
  27.  
  28.  
  29. private void FindChatRooms()
  30. {
  31.     DiscoItemsIq discoIq = new DiscoItemsIq(IqType.get);
  32.     discoIq.To = new Jid("muc.yourserver.com");
  33.     con.IqGrabber.SendIq(discoIq, new IqCB(OnGetChatRooms), null);
  34. }
  35.  
  36. private void OnGetChatRooms(object sender, IQ iq, object data)
  37. {
  38.     // Callback from IQGrabber
  39. }

as said before the IqGrabber is available in the latest version from SVN. If you are not familiar with SVN i can attach or upload the latest binary.

Regards,
Alex
Avatar
bmurphy #11
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Thank you so much.

I got the latest version from SVN last night and compiled it no problem, and IQgrabber is now in the component namespace so that is great thanks.

I tried your code snippet though and all is well except the "IqType" (as below) can only be derived from protocol.client and not protocol.component

  public DiscoItemsIq(IqType type)       : this()
            {
                this.Type = type;
            }

Are there more changes in SVN since yesterday that I need to go and get ?

Regards
Bernie
Avatar
Alex #12
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
IqType is the same class for client, server and components.

Try to add the full namespace agsXMPP.protocol.client.IqType. I did not try the code I posted, I just wrote it down in my post, sorry about that ;-).

The different namespaces are very confusing, but this is how the XMPP protocol is designed for now, and there is no other way if you want a namespace correct object orientated implementation.

Quote by bmurphy:
Are there more changes in SVN since yesterday that I need to go and get ?
no

Alex
Avatar
bmurphy #13
User title: Manager
Member since Jul 2008 · 11 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: callback for chat room discovery
Hi,

I've been out for a couple of weeks since the last post but have picked back up on this again and made some progress but get a further error. You may recall I am trying to dicsover chat rooms using a component connection. Your code snippet is helpful but it will not compile because of what appears to be a mismatch with the callback parameters .  I get  

No overload for 'OnGetChatRooms' matches delegate 'agsXMPP.IqCB'

in the code

    private void FindChatRooms()
        {
            DiscoItemsIq discoIq = new DiscoItemsIq(agsXMPP.protocol.client.IqType.get);
            discoIq.To = new Jid("conference.gbcdff1975m");
            comp.IqGrabber.SendIq(discoIq, new IqCB(OnGetChatRooms), null);
        }

        private void OnGetChatRooms(object sender,IQ iq,object data)
            //object sender, IQ iq, object data)
        {
            // Callback from IQGrabber
           
        }

any help appreciated
thanks
Avatar
ethomas #14
Member since Aug 2008 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: No overload matches delegate
I'm getting exactly the same error:

No overload for 'OnGetChatRooms' matches delegate 'agsXMPP.IqCB'
Avatar
Alex #15
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
I will check this and create a small example later today. First I have to setup a new test environment for this.

Alex
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:
Page:  1  2  next
Forum: agsXMPP RSS