Blocking - 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: Blocking (/showthread.php?tid=66185)
Blocking by mozzer on 09-13-2006 at 04:58 PM
Is it possible to block someone when they send you a message and then unblock them when they close the window/a timer ends?
RE: Blocking by Shondoit on 09-13-2006 at 05:21 PM
This should theoreticaly work...
I don't have MP!L to test atm, but it should work fine...
code: function OnEvent_ChatWndReceiveMessage (ChatWnd, Origin, Message, MessageKind) {
if (/(?:\s|^)Word(?:\s|$)/i.test(Message)) {
//This matches only whole words, to match pieces of a word too,
//use (/Word/i.test(Message)) instead
for (var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()) {
Contact = e.item()
Contact.Blocked = true
MsgPlus.AddTimer("Unblock" + Contact.Email, Time)
}
}
functionOnEvent_Timer (TimerId) {
if (/^Unblock(.+)$/.test(TimerId)) {
Email = RegExp.$1
var Contact = Messenger.MyContacts.GetContact(Email)
Contact.Blocked = false
}
}
RE: Blocking by mozzer on 09-13-2006 at 05:27 PM
Doesn't seem to work, could you add it so that any message will be accepted and I can only be from one email address to be blocked?
RE: Blocking by Shondoit on 09-13-2006 at 05:38 PM
Like if someone starts talking to you?
sure... (still can't test though)
code: var BlockedUser = "user@blocked.com"
function OnEvent_ChatWndReceiveMessage (ChatWnd, Origin, Message, MessageKind) {
for (var e = new Enumerator(ChatWnd.Contacts); !e.atEnd(); e.moveNext()) {
Contact = e.item()
if (Contact.Email == BlockedUser) {
Contact.Blocked = true
MsgPlus.AddTimer("Unblock", Time)
}
}
}
functionOnEvent_Timer (TimerId) {
var Contact = Messenger.MyContacts.GetContact(BlockedUser)
Contact.Blocked = false
}
}
|