About Detect User status - Printable Version
-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: About Detect User status (/showthread.php?tid=92615)
About Detect User status by xljeff on 10-18-2009 at 06:16 PM
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 ?
--------
RE: About Detect User status by matty on 10-19-2009 at 03:44 PM
js 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 '';
}
}
RE: About Detect User status by xljeff on 10-19-2009 at 04:13 PM
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 )
RE: About Detect User status by xljeff on 03-24-2010 at 03:19 AM
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 ^^
RE: About Detect User status by CookieRevised on 03-24-2010 at 12:23 PM
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.
|