What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Block Un-Wished Logins

Block Un-Wished Logins
Author: Message:
shallow
New Member
*


Posts: 2
Joined: Dec 2008
O.P. Block Un-Wished Logins
Hey guys!

Does anyb ody know, is it possible to block all un-wished logins? For Example I dont want to others to log in on my Msn, I would like to set the client to accept only my MSN adress to login.

(My brother has own computer, but he more likes to use my...  Is it possible to set the MSN, my adress can log in, but other adresses could not LOG IN?)

Thank you for responses!
12-22-2008 12:44 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Block Un-Wished Logins
Here's what you can do:
  1. Store your own email address in a global variable, for example:
    code:
    var sAllowedEmail = "myself@hotmail.com";
  2. In the OnEvent_Signin event, check the received first parameter (Email) against the allowed email address.
  3. If the email addresses match, do nothing.
  4. If the email addresses do not match, use Messenger.Signout() to make this unwanted user sign out. Display a friendly(?) toast message with MsgPlus.DisplayToast to inform them why he/she has just been signed out.
Although this will work great, it won't actually prevent them to sign in: they'll simply be signed out as soon as they are signed in, which is just as effective (and annoying) in my opinion. :P

Please, try not to ask us for copy-paste-ready code, this script request is very easy to achieve when you simply have a look at the scripting documentation. The best way to learn programming is by trying new things out yourself! ;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-22-2008 12:57 PM
Profile E-Mail PM Web Find Quote Report
shallow
New Member
*


Posts: 2
Joined: Dec 2008
O.P. RE: Block Un-Wished Logins
Works perfectly ty ;)

You are right, I was thinkin, and was able to create it. Another question: Can you tell me the function name, which helps me to IGNORE if I want to add a new contact on my list? ( I don't want more contacts on my list, and I am afraid, My brother will add his friends to my contact list to be able communicate with them on my msn -.- xD)

He wont understand, why he wont be able to connect with his adress, but if he wont be able to add contact to my list too, he will give up the fight xD

Thanks Matti if you help me again x)

This post was edited on 12-22-2008 at 01:43 PM by shallow.
12-22-2008 01:38 PM
Profile E-Mail PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
RE: Block Un-Wished Logins
Unfortunately, there's no such functionality built into the Plus! Live scripting system yet. I don't know if it's possible through some kind of Messenger ActiveX function, although I'd really be surprised if a script could intercept a contact from being added. (The standard Messenger API isn't that great...)

Good to see you managed to get the code working and good luck fighting your brother! :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-22-2008 07:27 PM
Profile E-Mail PM Web Find Quote Report
Pinecone
New Member
*

Avatar
Coffee Powered

Posts: 9
34 / Male / Flag
Joined: Dec 2008
RE: Block Un-Wished Logins
You can however hook into messenger and stop them just clicking the add contact button or whatever. I almost got it working, but for some reason it freezes the messenger main window after. I sent it to a friend of mine for testing and he didn't have the problem, so I'm unsure if it will work correctly for everyone or not. The point is, it stops them from adding contacts by clicking the add contact button or going through the menu. If anyone could provide any information on why this is freezing up my messenger, please respond to this post as i spent over 4 hours trying to figure it out to no avail.

code:
var WH_CBT = 5;
var HCBT_CREATEWND = 3;
var hHook;

function OnEvent_Initialize(MessengerStart) {
    hHook = Interop.Call('User32.dll', 'SetWindowsHookExW',
        WH_CBT,
        Interop.GetCallbackPtr('CBTProc'),
        Interop.Call('Kernel32.dll', 'GetModuleHandleW', 'MsgPlusLive.dll'),
        Interop.Call('Kernel32.dll', 'GetCurrentThreadId')
    );
}

function OnEvent_Uninitialize(MessengerExit) {
    if (hHook) Interop.Call('User32.dll', 'UnhookWindowsHookEx', hHook);
}

function CBTProc(nCode, wParam, lParam) {
    // MSDN said to simply return CallNextHook with no further processing if nCode<0
    if (nCode >= 0)
    // Check for notification of a window being created
    if (nCode == HCBT_CREATEWND) {
       
        // Is the window in question the add contact window
        if (GetClass(wParam) == 'MSNContacts_Dialog') {
           
            // Show Error message
            Interop.Call('User32.dll', 'MessageBoxW', 0, 'Erorr: You are not allowed to add a contact.', 0, 0x10);
           
            // MSDN says that returning anything other than 0 will stop the window being created.
            return 1;
               
        }
        // MSDN says that returning 0 allows the window to be created.
        return 0;
    }
   
    // Call next hook...
    return Interop.Call('User32.dll', 'CallNextHookEx', hHook, nCode, wParam, lParam);
}

// Returns the class name of hWnd
function GetClass(hWnd) {
    var Data = Interop.Allocate(0x200);
    Interop.Call('User32.dll', 'GetClassNameW', hWnd, Data, 0x200);
    var Class = Data.ReadString(0);
    Data.Size = 0;
    return Class;
}


This post was edited on 12-23-2008 at 06:52 PM by Pinecone.
12-23-2008 02:10 PM
Profile E-Mail PM Find Quote Report
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: RE: Block Un-Wished Logins
quote:
Originally posted by Pinecone
You can however hook into messenger and stop them just clicking the add contact button or whatever

Or you could change your password 8-|
12-28-2008 09:13 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
35 / Male / Flag
Joined: Aug 2006
RE: Block Un-Wished Logins
quote:
Originally posted by shallow
You are right, I was thinkin, and was able to create it. Another question: Can you tell me the function name, which helps me to IGNORE if I want to add a new contact on my list? ( I don't want more contacts on my list, and I am afraid, My brother will add his friends to my contact list to be able communicate with them on my msn -.- xD)

You could also skin away the add contact button, but they would still be able to accept requests

<Eljay> "Problems encountered: shit blew up" :zippy:
12-28-2008 09:57 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