Shoutbox

GetStatusChange - 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)
+----- Forum: Plug-Ins (/forumdisplay.php?fid=28)
+------ Thread: GetStatusChange (/showthread.php?tid=53924)

GetStatusChange by Tobiaz on 12-15-2005 at 04:21 PM

Hi!
So... there was no 'Code-Problem' on the board for a long time (i think), so I thought I could ask something! 8-|;)

Now, I wanted to do this freaky Text-to-Speech Plugin. My only Problem at the moment is, that I couldn't get the Friendlyname of this one, witch signed in!
I think for this you have to use this oMessenger thing (...), and I didn't work with it until yet.

So, how can I get the FriendlyName of the contact witch signed in!?

Thank you very much...


Greeeeez Tobiaz


RE: Get FriendlyName by Dempsey on 12-15-2005 at 04:25 PM

what programming language are you using?


RE: Get FriendlyName by Tobiaz on 12-15-2005 at 04:26 PM

Oh... I'm sorry for missing that :D

VB6...


Greeeeez


RE: Get FriendlyName by Dempsey on 12-15-2005 at 04:31 PM

something like:

code:
Dim oMessenger as object

Set oMessenger = oMessenger

MsgBox oMessenger.MySigninName

RE: Get FriendlyName by Tobiaz on 12-15-2005 at 04:37 PM

Yeees... But so I get my own Friendlyname... is that right!?

I need the FN of the contact witch signs in.

I don't know how and I don't know where I have to use the code...



Thanks (@ Dempsey)

Greeeez Tobiaz


RE: Get FriendlyName by Patchou on 12-15-2005 at 06:48 PM

Just use the Messenger object passed in parameters. The documentation of the Messenger API is part of the documentation given with the Plus! plugin API. In pesudo code it will be like:
IContact iContact = iMessenger.GetContact("contact@email.com");
string sContactName = iContact.getFriendlyName();


RE: Get FriendlyName by Tobiaz on 12-17-2005 at 10:38 AM

So, I have antoher little problem. Maybe that's a stupid question, but...

I have now this sub:

code:
Private Sub Form_Load()

Set objMessenger = New MessengerAPI.Messenger
Set Contacts = objMessenger.MyContacts


End Sub


Private Sub objMessenger_OnContactStatusChange(ByVal pMContact As Object, ByVal mStatus As MISTATUS)

If pMContact.Status = MISTATUS_ONLINE Then
    Status = "online"
ElseIf pMContact.Status = MISTATUS_BUSY Then
    Status = "Busy"
ElseIf pMContact.Status = MISTATUS_AWAY Then
    Status = "away"
ElseIf pMContact.Status = MISTATUS_BE_RIGHT_BACK Then
    Status = "brb"
ElseIf pMContact.Status = MISTATUS_ON_THE_PHONE Then
    Status = "onphone"
ElseIf pMContact.Status = MISTATUS_OUT_TO_LUNCH Then
    Status = "lunch"
ElseIf pMContact.Status = MISTATUS_OFFLINE Then
    Status = "offline"
End If


   
End Sub


But  how the hell can I call it!? Should it be called automatically!?
I don't get it...

Thanks for helping



Greeeeeeez Tobiaz
RE: GetStatusChange by Millenium_edition on 12-17-2005 at 10:41 AM

quote:
Originally posted by Tobiaz
But  how the hell can I call it!? Should it be called automatically!?
if a contact changes his/her status, it gets called, and all it does is assigning a value to an undeclared variable at this moment.
adding something along the lines of
code:
MsgBox Status
should give a result
RE: GetStatusChange by Tobiaz on 12-17-2005 at 11:50 AM

Coool. Thank you! It works perfect. I made it now with Toasts...
Only one problem:
If i sign in, there appers many Toast: One for every contact. Even if he is offline, the plugin let me know this... Do you know what i mean!?
If i sing in, theres a toast for every contact with his actual status...

How can I prevent this!?

thank you


Greeeez Tobiaz


RE: GetStatusChange by hmaster on 12-17-2005 at 12:00 PM

i dont know vb6 but if you removed

code:
ElseIf pMContact.Status = MISTATUS_OFFLINE Then
    Status = "offline"
then it wouldnt notify you the offline contacts *-)
RE: GetStatusChange by RaceProUK on 12-17-2005 at 12:12 PM

quote:
Originally posted by Tobiaz
If i sign in, there appers many Toast: One for every contact. Even if he is offline, the plugin let me know this... Do you know what i mean!?
If i sing in, theres a toast for every contact with his actual status...

How can I prevent this!?
As hmaster said, remove the line containing the test for MISTATUS_OFFLINE.

Quick tip: Since the MISTATUS enum is numbers, use a Select...Case construct. The code will look cleaner, and will run better.

Quick tip 2: For a quick-and-easy online check, regardless of status, use 'pIMContact.Status & MISTATUS_ONLINE'.

Quick tip 3: You should be able to prevent it showing toasts when you sign in if you check if the old status is equal to MISTATUS_UNKNOWN (IIRC, double-check).
RE: GetStatusChange by Millenium_edition on 12-17-2005 at 12:14 PM

quote:
Originally posted by hmaster
i dont know vb6 but if you removed
code:
ElseIf pMContact.Status = MISTATUS_OFFLINE Then
    Status = "offline"
then it wouldnt notify you the offline contacts *-)
don't do that

the sign in process consists of:
<notifications of every contact list item on "offline">
<OnSignIn event>
<every contact gets his initial status (list of online contacts)>

so you could use the onsignin event and a boolean to avoid all those "offline" popups
RE: GetStatusChange by Tobiaz on 12-17-2005 at 05:32 PM

quote:
Originally posted by Millenium_edition
the sign in process consists of:
<notifications of every contact list item on "offline">
<OnSignIn event>
<every contact gets his initial status (list of online contacts)>

Oh... that's a litte bit complicated. Could you post a Sample!?

thank you


Greeeeeeez Tobiaz