Shoutbox

Block Command - Messenger API - 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: Block Command - Messenger API (/showthread.php?tid=31541)

Block Command - Messenger API by michael_m91 on 09-15-2004 at 04:58 AM

How do you use the block command with Plugins.
not like sresult = "/block"

i wan't to use the Messenger API


RE: Block Command - Messenger API by RaceProUK on 09-15-2004 at 11:26 AM

Take a look at the attached file.


RE: Block Command - Messenger API by michael_m91 on 09-15-2004 at 12:30 PM

quote:
Originally posted by raceprouk
Take a look at the attached file.
Thankyou but i've looked at it a few times i just wan't someone to help me with this one.
RE: Block Command - Messenger API by Millenium_edition on 09-15-2004 at 12:33 PM

quote:
Originally posted by raceprouk
Take a look at the attached file.

and if you can't look at the attached file we can't help you. we're not code bitches :)
RE: Block Command - Messenger API by michael_m91 on 09-15-2004 at 12:42 PM

quote:
Originally posted by Millenium_edition
quote:
Originally posted by raceprouk
Take a look at the attached file.

and if you can't look at the attached file we can't help you. we're not code bitches :)

Alright... I just am having troubles understanding this one btw

Edit by michael_m91:
code:
Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContact As MessengerAPI.IMessengerContact

Private Sub btnBlocked_Click()
    On Error Resume Next
    Dim strSigninName As String
    Dim strServiceID As String
    'Get selected contact
    strSigninName = ListContact.SelectedItem.SubItems(2)
    strServiceID = ListContact.SelectedItem.SubItems(5)
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    If MsgrContact.Blocked = True Then
        MsgrContact.Blocked = False
        MsgBox("Contact: " & CStr(MsgrContact.SigninName) & " is now Unblocked")
    Else
        MsgrContact.Blocked = True
        MsgBox("Contact: " & CStr(MsgrContact.SigninName) & " is now Blocked")
    End If
    ErrorTrap ("Contact.Blocked")    'Error handling routine
    populateListView    'Refresh contact list
End Sub

I don't understand how to name what contact I wan't to block.
RE: Block Command - Messenger API by Millenium_edition on 09-15-2004 at 12:53 PM

code:
Private WithEvents objMessenger As MessengerAPI.Messenger

Private Sub Form_Load()
Set objMessenger = new MessengerAPI.Messenger
End Sub
should get you started. then you can use this to block someone
code:
Private Sub BlockContact (ByVal strContact As String)
objMessenger.GetContact(strContact, objMessenger.Services.PrimaryService).Blocked = True
End Sub

RE: RE: Block Command - Messenger API by michael_m91 on 09-15-2004 at 01:10 PM

quote:
Originally posted by Millenium_edition
code:
Private WithEvents objMessenger As MessengerAPI.Messenger

Private Sub Form_Load()
Set objMessenger = new MessengerAPI.Messenger
End Sub
should get you started. then you can use this to block someone
code:
Private Sub BlockContact (ByVal strContact As String)
objMessenger.GetContact(strContact, objMessenger.Services.PrimaryService).Blocked = True
End Sub


Do I specify which contact with "ctrContact" and how do I specify which contact (Friendly Name? Service Id? what?)

This objmessenger isnt in the Messenger API right? It's prat of the plugin making stuff.
RE: Block Command - Messenger API by CookieRevised on 09-15-2004 at 01:20 PM

quote:
Originally posted by michael_m91
I don't understand how to name what contact I wan't to block.
Even without understanding the exact meaning of things you can easly figure that out:

MsgBox("Contact: " & CStr(MsgrContact.SigninName) & " is now unblocked")

this shows something like: "Contact: contacts name is now unblocked"... this means that Contacts name = MsgrContact.SigninName

Now step back in the source. Where is MsgrContact.SigninName defined? here:

Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)

So what is strSigninName? Just simple step back:

strSigninName = ListContact.SelectedItem.SubItems(2)

There you have it: ListContact.SelectedItem., a listcontrol and together with btnBlocked_Click() I see that this code is a sub for when you click on a button on a form with a listcontrol which contains the contactnames/mails.


All in all, this is basic programming stuff and actually very easy to understand if you can program a very small bit. If you can't (and you can't reconize what a variable, object and/or property is), then I suggest you to first learn easier and basic programming stuff, before attempting doing stuff with API's, objects, protocol-handling, etc...
RE: Block Command - Messenger API by Millenium_edition on 09-15-2004 at 01:21 PM

it's the messengerapi library, and in strContact you place the obvious, the e-mail address.


RE: Block Command - Messenger API by michael_m91 on 09-16-2004 at 12:35 AM

code:
Public WithEvents MsgrUIA As MessengerAPI.Messenger
Public MsgrContact As MessengerAPI.IMessengerContact

Private Sub btnBlocked_Click()
    On Error Resume Next
    Dim strSigninName As String
    Dim strServiceID As String
    'Get selected contact
    strSigninName = ListContact.SelectedItem.SubItems(2)
    strServiceID = ListContact.SelectedItem.SubItems(5)
    Set MsgrContact = Nothing
    Set MsgrContact = MsgrUIA.GetContact(strSigninName, strServiceID)
    ErrorTrap ("GetContact")    'Error handling routine
    If MsgrContact.Blocked = True Then
        MsgrContact.Blocked = False
        MsgBox ("Contact: " & CStr(MsgrContact.SigninName) & " is now Unblocked")
    Else
        MsgrContact.Blocked = True
        MsgBox ("Contact: " & CStr(MsgrContact.SigninName) & " is now Blocked")
    End If
    ErrorTrap ("Contact.Blocked")   'Error handling routine
    populateListView    'Refresh contact list
End Sub


The following are what my code complains about