Not logged in. · Lost password · Register
Forum: agsXMPP RSS
1.Open for chat to every one   2.Check if a username is already registered
Avatar
rahabm #1
Member since Nov 2007 · 5 posts
Group memberships: Members
Show profile · Link to this post
Subject: Two things (Questions)
Hi,

I am kind of new with Jabber in general.
I wrote a very simple app, where someone can chat to someone else, everything is working fine, for example when I use my application to chat with some one else who is using PSI or other commercial clients, everything is fine, But when the other person from commercial clients want to chat with me They cant because I have not added them to my list using :

xmpp.MesagageGrabber.Add(JID, new agsXMPP.Collections.BareJidComparer(), new MessageCB(MessageCallback), null);

JID is the address of the reciever.

So is there something that I have to do or use to make my client open to everyone so others can start chatting with me rather that I start first.


The second I want to know is how I can find out if someone is registered with my server from my client ? I want to do this so user will be notified if they already registered so they can choose another username !!!

That is it really for now.

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

if a contact sends you a message you will get the OnMessage event from XmppClientConnection.
From this event you have to open a new message window or mesage tab and forward the message to this window, or find the message window if its already open and forward the message.
The MessageGrabber class is a helper class which makes tis process much easier. Once you have a message window you can tell the MessageGrabber to raise a callback for a new messages from jid x. In the MiniClient example you can see how to use the MessageGrabber correctly.

No you can't figure out from the client if a userid is registered or not. And there are reasons why this is not supported in XMPP (eg SPAM/SPIM protection). If you run your own server you can lookup the usernames in the server database and write a xmpp extension or simple (web) script which tells you if the user exists or not.

Alex
Avatar
rahabm #3
Member since Nov 2007 · 5 posts
Group memberships: Members
Show profile · Link to this post
Thanks Alex,

Ok, I understand all that now (kind of). But how about if I want to find out if someone on the server is online or offline? By the way What is Roster exactly ? I dont have a clear understanding of it ?! 


Thanks
Avatar
Alex #4
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The roster is your contact list.
To find out if someone is online you have to add the contact to your roster and ask for subscription. If the contact approves the subscription you will see his/her presence and get all presence updates in the OnPresence event of XmppClientConnection.

If the contact is not on your roster or denies your subscription request you will not get his/her presence.

Look in the MiniClient example at frmAddRoster, frmSubscribe and the OnPresence handler.

Alex
Avatar
rahabm #5
Member since Nov 2007 · 5 posts
Group memberships: Members
Show profile · Link to this post
Thanks again,

So Roster is just a list that holds your friend's information, in a table ?

I Dont want the users do this themseves ! I want as administrator choose who is or is not on their list.

Is there any option on Jabber Server, that let me do this, or I need to write a script or something that create this roster list ?

In another word, I want to create the user's roster list for them. So they just login and wait for someone to chat with them or they chat to someone else on their roster list.

Thank you !
Avatar
Alex #6
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by rahabm:
In another word, I want to create the user's roster list for them. So they just login and wait for someone to chat with them or they chat to someone else on their roster list.
yes this is possible with the most XMPP servers. For more details look at the documentation of your preferred server.

Alex
Avatar
rahabm #7
Member since Nov 2007 · 5 posts
Group memberships: Members
Show profile · Link to this post
Thanks

But lets say a user is in my Roster's list (not the UI one) just the databse.
I can see it working on PSI ( I could add a Roster programmatically)

But How can I get the status (online, offline, etc) of that user in my own client without using your UI roster components ?

Lets say I know that user's user name too ?

It would be good if you show with code. I can understand your MiniClient, but you are using Roster UI for that, and u get the Status of someone from there, dont you ?

So how can i get the status without using Ui ?
Avatar
Alex #8
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
you get the presence of all your contacts automatically after you sent your own presence after successful login to your server. The presences com in the OnPresence event of XmppClientConnection.

Alex
Avatar
rahabm #9
Member since Nov 2007 · 5 posts
Group memberships: Members
Show profile · Link to this post
Hi Alex

You lost me there man :( could you elaborate a little bit more here !  I really need to do this part ! very very important.

I just want to see if a user in my roster is online or offline after logging in !

Thats it really. You said there is a list, from OnPresence, right ? But how can I get that list, it it something like this :

XmppCon.OnPresence += new PresenceHandler(XmppCon_OnPresence);

But from there I need some help to do the rest, What should i do ? If i understand this part I will understand the rest of the library on my own hopefully.
Avatar
Alex #10
Member since Feb 2003 · 4317 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by rahabm:
You lost me there man :( could you elaborate a little bit more here !  I really need to do this part ! very very important.
then you should consider a commercial license of agsXMPP which includes professional support services.

Please study the MiniClient examples. There is everything you need. The VB MiniClient and WM5 MiniClient examples don't use the UI control for the roster.

OnPresence is called on each status change of a contact. In the presence object is the Jid, status and showtype of the contact. If contacts are offline you get no OnPresence event from them. So consider contacts as offline until you get another status/showtype from them in the OnPresence handler.

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: agsXMPP RSS