Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
owen #1
Member since Nov 2006 · 21 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Subject: Change another user's presence remotely
Is it possible or acceptable to remotely update the presence of another user?  I am developing an application where a supervisor may control their users' IM availablity.

For example the supervisor may set the status of certain users to be "in meeting" or "on holiday" or "with customer".  However, the users may or may not be logged into their IM client when this happens.  My hope is, as a supervisor, I could update the presence of my end users and they would see it change in front of them, without them having to physically change it themselves.

I know this can be done via the IM server app (eg. Wildfire admin) in some cases, but it's important that I am able to build it into my own application.

What is the best way of doing this?

Is it even possible?


Thanks!
Owen
Avatar
Alex #2
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Owen,

yes it's possible.
eg with PSI you can remote control your other connected PSI clients using Ad-Hoc-Commands (XEP-0050).

there are also other solutions which will work. But you can only remote control clients which are conncted. if a user is offline the presence is offline some status message and you can't control it remotely. In this case the client must stay online during the holiday, or the supervisor must login on behalf of this user, change the offline presence, and log off.
With SASL authentication it would be also possible to give the supervisor the permissions to log in with his own password in behalf of the users.

Alex
Alexander Gnauck
AG-Software
Avatar
owen #3
Member since Nov 2006 · 21 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Thank you, Alex.  You've given some very useful info.  Ad-Hoc Commands seems the way to go.

I've taken a look at the link you posted, and it's very in-depth, in fact so in-depth that I hardly know where to begin...  it rather blows my mind, to be honest.  So, from what I gather, these "Ad Hoc Commands" are extra commands that sit outside the agsXMPP object model, right?  So there arent agsXMPP procedures or functions for these Ad Hoc Commands?

This frightens me.  I don't know where to begin trying to code something to read/write a user's status.  I'll re-read the document again, many times, but right now I'm stumped.

What would really help me is some example vb.net code. 

Even being able to READ another person's status would be a good start.

Could you start me off by posting a quick example of an Ad Hoc Command in vb.net for obtaining a user's current status (given their Jid, perhaps)?  Or, if you're feeling generous, an example of changing their status remotely as well?  

I just can't fathom how to do this myself.  I am stupid and need a little more help. I need to construct a couple of simple functions like:

function getUserStatus(Jid as string) as string
eg. to get Fred's status: Dim FredStatus as string = getUserStatus("fred@myserver")

and

sub setUserStatus(Jid as string, statusText as string)
eg. to mark Fred as busy: setUserStatus("fred@myserver","busy")

(If such an example exists in that web page, please direct me back to it.)

Thanks!
Owen
This post was edited 2 times, last on 2007-01-03, 12:54 by owen.
Avatar
Alex #4
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello Owen,

Thank you, Alex.  You've given some very useful info.  Ad-Hoc Commands seems the way to go.

I've taken a look at the link you posted, and it's very in-depth, in fact so in-depth that I hardly know where to begin...  it rather blows my mind, to be honest.  So, from what I gather, these "Ad Hoc Commands" are extra commands that sit outside the agsXMPP object model, right?  So there arent agsXMPP procedures or functions for these Ad Hoc Commands?

the Ad-Commands are in the SDK. Take a look at the agsXMPP.protocol.extensions.commands namespace

This frightens me.  I don't know where to begin trying to code something to read/write a user's status.  I'll re-read the document again, many times, but right now I'm stumped.

Commands are only one way to do it. I proposed them because existing software is using them for the same case.
You could take a look at the PSI client which implements commands for remote controlling. Start up 2 PSI clients (best is on 2 machines, or one physical and one virtual), log in with the same user but different resources. Then you should be able to control one client from the other. Open the XML debug console and take a look at the XMPP packets.

But as i said this is only one solution. XMPP is very extensible, therefore there are many solutions. You can also define your own protocols for remote controlling. The manual "creating own packet types" is a good example for that.

What would really help me is some example vb.net code.

sorry, there is currently no example code. You can take a look at the file transfer code, it using a very small subset of commands. But i don't think this will help you a lot. We are currently very busy creating a new release version of the SDK. Once this is done we can take a look at this and write a small example.

Alex
Alexander Gnauck
AG-Software
Avatar
Alex #5
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post #3
Quote by owen:
I just can't fathom how to do this myself.  I am stupid and need a little more help. I need to construct a couple of simple functions like:

function getUserStatus(Jid as string) as string
eg. to get Fred's status: Dim FredStatus as string = getUserStatus("fred@myserver")

and

sub setUserStatus(Jid as string, statusText as string)
eg. to mark Fred as busy: setUserStatus("fred@myserver","busy")

how do you handle the permissions? Do you hardcode them in a database?
Or do you use some kind of password protection to change the status?

set and get status must use full Jabber Ids of the format fred@myserver/Office

Alex
Alexander Gnauck
AG-Software
Avatar
owen #6
Member since Nov 2006 · 21 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Thanks Alex,

I think I've decided that Ad Hoc Commands are the best route for now.  But I'm still struggling.  Thanks for pointing me to agsXMPP.protocol.extensions.commands, this is great, except that I've no idea how to use the commands I find there.  I've looked at the online documentation but, as you mentioned, there is currently no example code.

I'm struggling with the fundamentals, eg. what is meant by "Command", "Action" and "Note"?

How do I use these to create something that will remotely get/set the status of fred@myserver? 

When you said I "must use full Jabber Ids of the format fred@myserver/Office" -- "Office" is a password, correct?

Regarding your Q about permissions, I'm not sure what you mean.  If you mean, "how do I control who is allowed remote control over user status?" the answer is, short term, it doesn't matter.  I thought I'd just have a single "Remote Supervisor" user who could do this (to start with).  But longer term, all users might have their permissions stored on a database. (Including stuff like what kind of automated IMs they receive from my application). 

The point is, I need to be able to set & get status of other users somehow.

I would really appreciate any more clues that might help me.  I've got access to the agsXMPP.protocol.extensions.commands namespace but I don't know where to go next.  Could you point me in the right direction a bit more?

Thanks!
Owen
Avatar
Alex #7
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by owen:
When you said I "must use full Jabber Ids of the format fred@myserver/Office" -- "Office" is a password, correct?

no, Office is the resource which the client used on login. Keep i mind that in XMPP a user can login multiple times to a server with the same or other client with different resources.
This is also the reason why you have to send IQs like the command Iqs always to full JabberId's. If you send it to a base Jids the server responds with an error.

Quote by owen:
Regarding your Q about permissions, I'm not sure what you mean.  If you mean, "how do I control who is allowed remote control over user status?" the answer is, short term, it doesn't matter.  I thought I'd just have a single "Remote Supervisor" user who could do this (to start with).  But longer term, all users might have their permissions stored on a database. (Including stuff like what kind of automated IMs they receive from my application). 

If you client runs in a closed network this might be OK.

Quote by owen:
I would really appreciate any more clues that might help me.  I've got access to the agsXMPP.protocol.extensions.commands namespace but I don't know where to go next.  Could you point me in the right direction a bit more?

You should take a look at this example:
http://www.xmpp.org/extensions/xep-0050.html#execute-multi…

  • Execute a command which you name pres, presence or whatever
  • The 2nd client returns a xdata form with all the possible presence states and a textbox for the status message if you need it
  • Client 1 submits this form to client 2
  • Client 2 evaluates the result and changes the presence if there is no error.

Alex
Alexander Gnauck
AG-Software
Avatar
Alex #8
Member since Feb 2003 · 4245 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
If your needs are more immediate, we can add this for you via the professional services we offer.  If you are interested, please contact the AG-Software Sales at sales@ag-software.de
Alexander Gnauck
AG-Software
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: agsXMPP SDK Support RSS