What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » About Detect User status

About Detect User status
Author: Message:
xljeff
New Member
*


Posts: 11
Joined: Sep 2009
O.P. About Detect User status
Thanks for your Help !

Question :

Very sorry about that , i try to find some post about this , but can't find..
maybe it is very easy ~ ORZ
--------
If I want to detect user status (online , offline , busy , away....) before i send message to user , how can i do ?
--------


This post was edited on 10-18-2009 at 06:18 PM by xljeff.
10-18-2009 06:16 PM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: About Detect User status
Javascript code:
function OnEvent_ChatWndSendMessage ( oChatWnd , sMessage ) {
    if ( oChatWnd.Contacts.Count !== 1 ) return sMessage; // Don't bother doing anything if there is more than one contact in the conversation
   
    // Get the contact object
    var oContact = new Enumerator ( oChatWnd.Contacts ).item();
   
    // Check if the user is online, if they are send the message
    if ( oContact.Status === STATUS_ONLINE ) {
        return sMessage;
    }
    else {
        // If the contacts status isn't online then cancel the message.
        return '';
    }
}

10-19-2009 03:44 PM
Profile E-Mail PM Find Quote Report
xljeff
New Member
*


Posts: 11
Joined: Sep 2009
O.P. RE: About Detect User status
Thank you very Much !

It's work !

and i add some information about "Status" list
maybe someone need !

STATUS_OFFLINE ( 1 )
STATUS_ONLINE ( 3 )
STATUS_BUSY ( 4 )
STATUS_BRB ( 5 )
STATUS_IDLE ( 6 )
STATUS_AWAY ( 7 )
STATUS_INCALL ( 8 )
STATUS_OUTLUNCH ( 9 )

This post was edited on 10-19-2009 at 04:13 PM by xljeff.
10-19-2009 04:13 PM
Profile E-Mail PM Find Quote Report
xljeff
New Member
*


Posts: 11
Joined: Sep 2009
O.P. RE: About Detect User status

Thank you guys 1!
I have another question ....
---

the last answer detect user status "before" message send BUT  it must "After" get contect (ChatWindow open already)

Is there anyway can detect user status "Before ChatWindow open" ??

ps. I just don't want to send message to offline user , because the message will be reject , and chat window will keep on desktop, i need to close it...

---

Thank you ^^
03-24-2010 03:19 AM
Profile E-Mail PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: About Detect User status
matty's example showed how to get the status of a contact when you open the conversation window. But the status property belongs to the contact object. This object is always available. So you don't need to first open a conversation window, it can be checked before too. In matty's example you get that contact object from the contacts who are in the conversation window, but you can just as well get that object from your contact list.

So, all you need to do is get the contact object from the contact you which to check upon. This can be done by using the Messenger::MyContacts object, which will give you a contacts object, which will have a getcontact method.

Anyways, all this info can be found in the Scripting documentation.
Go to the index tab and there you have all the object, properties and methods you can use....

var oContacts = Messenger.MyContacts
var oContact = oContacts.GetContact("contact@mail.com")
var eStatus = oContact.Status

PS: also check out the ChatWnd::EditChangeAllowed property! This property indicates if you actually can send a message or not. It should always be used before ChatWnd::SendMessage.

This post was edited on 03-24-2010 at 12:27 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
03-24-2010 12:23 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On