Not logged in. · Lost password · Register
Forum: MatriX RSS
Reading Incoming Messages
Avatar
sreenivas.kaushik #1
Member since Aug 2015 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: Read Incoming Messages.
Hello Alex,

I am new to agsXMPP and my requirement is to read all the incoming messages using agsXMPP library in my .net application. I tried using the below code, through which i can read the incoming messages for the logged in user.

void OnLogin(object sender)
        {
            xmppCon.Server = "abc.com";
            xmppCon.ConnectServer = "Server Ip";
            xmppCon.Port = 5222;
            xmppCon.Username = "user3";
            xmppCon.Password = "password";

            try
            {
                xmppCon.OnAuthError += new XmppElementHandler(OnAuthError);
                xmppCon.OnLogin += new ObjectHandler(OnLogin);
                xmppCon.OnMessage += new MessageHandler(OnMessage);

                xmppCon.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.StackTrace);
            }
           
        }

private void OnMessage(object sender, agsXMPP.protocol.client.Message msg)
        {
            var From = msg.From;
            var Subject = msg.Body;
            var To = msg.To;
        }

But as per my requirement i need to read all the incoming messages irrespective of logged in user (like admin user). Is it possible to login as admin user and read all the incoming message? e.g. if user1 sends the message to user2 still i should read the messages as a admin user.

Could you please provide some sample code handle this issue.

Thanks in Advance.

Thanks & Regards,
Sreenivas Kaushik
Avatar
Alex #2
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by sreenivas.kaushik:
Hello Alex,

I am new to agsXMPP and my requirement is to read all the incoming messages using agsXMPP library in my .net application. I tried using the below code, through which i can read the incoming messages for the logged in user.

  1. void OnLogin(object sender)
  2. {
  3.     xmppCon.Server = "abc.com";
  4.     xmppCon.ConnectServer = "Server Ip";
  5.     xmppCon.Port = 5222;
  6.     xmppCon.Username = "user3";
  7.     xmppCon.Password = "password";
  8.  
  9.     try
  10.     {
  11.         xmppCon.OnAuthError += new XmppElementHandler(OnAuthError);
  12.         xmppCon.OnLogin += new ObjectHandler(OnLogin);
  13.         xmppCon.OnMessage += new MessageHandler(OnMessage);
  14.  
  15.         xmppCon.Open();
  16.     }
  17.     catch (Exception ex)
  18.     {
  19.         MessageBox.Show(ex.StackTrace);
  20.     }
  21.    
  22. }
  23.  
  24. private void OnMessage(object sender, agsXMPP.protocol.client.Message msg)
  25. {
  26.     var From = msg.From;
  27.     var Subject = msg.Body;
  28.     var To = msg.To;
  29. }

But as per my requirement i need to read all the incoming messages irrespective of logged in user (like admin user). Is it possible to login as admin user and read all the incoming message? e.g. if user1 sends the message to user2 still i should read the messages as a admin user.

Could you please provide some sample code handle this issue.

Thanks in Advance.

Thanks & Regards,
Sreenivas Kaushik
Avatar
Alex #3
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
this is not possible. If you want to do something like that you have to extend your server so that it sends a copy of all messages to admin users. Or write a server module/plugin.

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:
Forum: MatriX RSS