Shoutbox

[REQUEST] Group chat monitor...er? - 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: [REQUEST] Group chat monitor...er? (/showthread.php?tid=90068)

[REQUEST] Group chat monitor...er? by Jigain on 04-08-2009 at 02:47 PM

If at all possible, I would greatly appreciate it if someone took the time and effort to create a script that:

  • Was executed as soon as a group chat is initiated,
  • Checks for any message you send to the group chat,
  • If no message has been sent for, say, two minutes, executes the primary function of the script.

The primary function would, in my mind, consist of three separate actions:

  • Send a predefined (preferrably user customizable) message to the group chat.
  • Close the group chat window.
  • Alert the user, when he/she arrives at his/her computer, that a group chat was initiated while you were away.

The very purpose of this is - as I myself has been the victim of many a times - to stop the senseless people who live on the other side of the world, figure they're bored, and invite everyone on their contact list regardless of status, without asking first, to a massive group chat. Last time I had almost an entire essay to scroll through - I blocked the responsible person after explaining I can't accept that.

I'm sure the idea can do with some polishing, and I don't even know if it's possible. Input very much appreciated.
RE: [REQUEST] Group chat monitor...er? by matty on 04-08-2009 at 03:25 PM

Javascript code:
var oChatWnd = {};
 
function OnEvent_ChatWndCreated( pChatWnd ) {
    __add ( pChatWnd );
}
 
function OnEvent_ChatWndDestroyed( pChatWnd ) {
    __remove ( pChatWnd.Handle );
}
 
function OnEvent_ChatWndSendMessage( pChatWnd, sMessage ) {
    __remove( pChatWnd.Handle );
}
 
function OnEvent_Timer( sTimerId ) {
    if ( oChatWnd[ parseInt( sTimerId ) ].iSecondCounter === 120 ) {
        oChatWnd[ parseInt( sTimerId ).pChatWnd.SendMessage( 'I am currently away from my computer. This is an auto-disconnect message that occures after 2 minutes of inactivity.' );        __remove( sTimerId );
    } else {
        oChatWnd[ parseInt( sTimerId ) ].iSecondCounter++;
        MsgPlus.AddTimer( sTimerId, 1000 );
    }
}
 
function __add( pChatWnd ) {
    if ( pChatWnd.Contacts.Count ) === 1 ) return;
    oChatWnd[ pChatWnd.Handle ] = {};
        oChatWnd[ pChatWnd.Handle ].pChatWnd = pChatWnd;
        oChatWnd[ pChatWnd.Handle ].iSecondCounter = 0;
    MsgPlus.AddTimer( pChatWnd.Handle, 1000 );
}
 
function __remove( pChatWnd ) {
    if ( typeof oChatWnd[ parseInt( pChatWnd ) ] === 'undefined' ) return;
 
    var s=''    for ( var e = new Enumerator( oChatWnd[ parseInt( pChatWnd ) ].pChatWnd.Contacts ); !e.atEnd(); e.moveNext() {        s+=e.item().Email+ ( !e.atEnd() ? ', ' : '' );    }     MsgPlus.LogEvent( 'Group chat', 'A group chat session was initiated with '+s+' however was closed after 2 minutes of inactivity.', EVICON_PLUS );    MsgPlus.CancelTimer( pChatWnd );
    Interop.Call( 'user32', 'SendMessageW', parseInt( pChatWnd ), 0x10 /* WM_CLOSE */, 0, 0 );
    delete oChatWnd[ parseInt( pChatWnd ) ];
}


I dunno something like that... this closes the chat window after 2 mins of not saying anything...
RE: [REQUEST] Group chat monitor...er? by Jigain on 04-08-2009 at 03:39 PM

Wow, that made no sense at all to me. ;)

So, now we're missing weaving in the message just prior to closing, leaving a notification that there has been a group chat, and something I forgot to mention, stopping the script the first time the user says anything - to keep the user from having to reply within two minutes constantly. Oh, and making the rule only apply to group chats.

Many thanks to you for taking it this far!


RE: [REQUEST] Group chat monitor...er? by matty on 04-08-2009 at 05:20 PM

quote:
Originally posted by Jigain
stopping the script the first time the user says anything
to keep the user from having to reply within two minutes constantly
making the rule only apply to group chats
The above is already taken care of...

quote:
Originally posted by Jigain
weaving in the message just prior to closing
Done

the notification thing well thats something else all depends how it is to be done.
RE: [REQUEST] Group chat monitor...er? by Jigain on 04-09-2009 at 04:43 AM

Splendid, excellent work and many thanks!

As for notifications, I don't know what scripts can do... send a mail to yourself? Or an instant message to yourself? Something else?


RE: [REQUEST] Group chat monitor...er? by matty on 04-09-2009 at 01:01 PM

The easiest way would be to use the Event Viewer to signify that the conversation window was closed and you can have the events written to a file.

- Added (the second highlighted code block in the post)


RE: [REQUEST] Group chat monitor...er? by Jigain on 04-10-2009 at 05:31 AM

Splendid, thank you very much!