What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Ping? Pong! Plugin

Pages: (2): « First « 1 [ 2 ] Last »
Ping? Pong! Plugin
Author: Message:
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
O.P. RE: RE: Ping? Pong! Plugin
quote:
Originally posted by trax
I don't know if this works..
You can make the the /ping command send a time..
or thisplay it..
for example:
person1
sends the ping,
Ping: 18:48:45
Person2
sends the pong
Pong: 18:48:43

if u can make a variable like "time"
and let it act likr
Person2time - person1time = "totaltime"

I REALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLY don't know if it works


I've tried that mutliple times but even though sometimes it seems possible. it isnt :(
The previous sentence is false. The following sentence is true.
07-07-2003 05:56 PM
Profile PM Find Quote Report
trax
Junior Member
**


Posts: 27
Joined: Nov 2002
RE: Ping? Pong! Plugin
ahh ok

seems like a nice idea though
07-07-2003 06:01 PM
Profile E-Mail PM Find Quote Report
Finn
Junior Member
**


Posts: 41
– / Male / –
Joined: Jul 2003
RE: RE: RE: Ping? Pong! Plugin
quote:
Originally posted by segosa
quote:
Originally posted by trax
I don't know if this works..
You can make the the /ping command send a time..
or thisplay it..
for example:
person1
sends the ping,
Ping: 18:48:45
Person2
sends the pong
Pong: 18:48:43

if u can make a variable like "time"
and let it act likr
Person2time - person1time = "totaltime"

I REALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLY don't know if it works


I've tried that mutliple times but even though sometimes it seems possible. it isnt :(


you mean like this? ;)


//////////////////////////////////////////////////////////////////////
//                                                                    //
// Project: Messenger Plus! simple plugin in language C                //
// Author: Patchou                                                    //
// Last Update: 2003/07/02                                            //
//                                                                    //
// For more help, please read the documentation in MPPluginHeader.h //
//                                                                    //
//////////////////////////////////////////////////////////////////////

#include "MPPluginC.h"
#include <stdio.h>
#include <time.h>

//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: DLL Entry Point                                            //
//                                                                    //
//////////////////////////////////////////////////////////////////////
BOOL APIENTRY DllMain(HANDLE hModule, DWORD nReason, void* pReserved)
{
    return TRUE;
}


//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: Initialization function                                    //
//                                                                    //
//////////////////////////////////////////////////////////////////////
MPPLUGIN_RETURN_BOOL Initialize(/*[in]*/ DWORD nVersion,
                                /*[in]*/ const char* sUserEmail,
                                /*[in]*/ IDispatch* iMessengerObj)
{
    return TRUE;
}


//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: Uninitialization function                                //
//                                                                    //
//////////////////////////////////////////////////////////////////////
MPPLUGIN_RETURN_VOID Uninitialize()
{
}

char * ConvertHex(char *string, unsigned int *Val)
{
    int len = 8;
    int ret = 0;

    while (*string && len > 0)
    {
        int toups = toupper(*(string++));

        if (toups >= '0' && toups <= '9')
        {
            ret<<=4;
            ret += toups - '0';
        } else if (toups >= 'A' && toups <= 'F') {
            ret<<=4;
            ret += (toups - 'A') + 10;
        }
        len--;
    }
    *Val = ret;
    return string;

}


char *WriteHex(char *Buf, unsigned int dw)
{
    static char* Hex = "0123456789ABCDEF";

    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;
    *(Buf++) = Hex[(dw>>28)&0xF];
    dw<<=4;

    return Buf;
}

int bDisablePING;
int bDisablePONG;
//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: Provide new commands in Messenger Plus!                    //
//                                                                    //
//////////////////////////////////////////////////////////////////////
MPPLUGIN_RETURN_BOOL ParseCommand(/*[in]*/  const char* sCommand,
                                  /*[in]*/  const char* sCommandArg,
                                  /*[in]*/  PLUGIN_PARAM* pParam,
                                  /*[out]*/ char* sResult)
{
    //The first sample command displays a hello box and cancels the
    //message
    if(stricmp(sCommand, "/xping") == 0)
    {
        *(sResult++) = *sCCNotify;
        strcpy(sResult, "PING!"); //The notify code must be 5 characters long
        sResult+= 5;
        sResult = WriteHex(sResult, clock());
        strcpy(sResult, " Ping Request");
        bDisablePING = TRUE;
        return TRUE;
    }
    return FALSE;
}


//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: Provide new tags in Messenger Plus!                        //
//                                                                    //
//////////////////////////////////////////////////////////////////////
MPPLUGIN_RETURN_BOOL ParseTag(/*[in]*/  const char* sTag,
                              /*[in]*/  PLUGIN_PARAM* pParam,
                              /*[out]*/ char* sResult)
{

    return FALSE;
}


//static char buf[4096];

DWORD WINAPI ShowResult( void *Param)
{
    unsigned int MSTaken = (unsigned int)Param;
    char buf[200];
    wsprintf((char*)buf, "Ping Result was %4dMS", MSTaken);
    MessageBox(NULL, buf, "PONG!", MB_OK);
    return 1;
}

//////////////////////////////////////////////////////////////////////
//                                                                    //
// Purpose: Allow special actions when a plugin text is received    //
//                                                                    //
//////////////////////////////////////////////////////////////////////
MPPLUGIN_RETURN_BOOL ReceiveNotify(/*[in]*/  const char* sNotifyCode,
                                   /*[in]*/  const char* sText,
                                   /*[in]*/  PLUGIN_PARAM* pParam,
                                   /*[out]*/ char* sTextToSend)
{
    if(strcmp(sNotifyCode, "PING!") == 0 && strlen(sText) > 7)
    {
        if (!bDisablePING) {
            *(sTextToSend++) = *sCCNotify;
            strcpy(sTextToSend, "PONG!"); //The notify code must be 5 characters long
            sTextToSend += 5;
            strncpy(sTextToSend, sText, 8);
            sTextToSend += 8;
            strcpy(sTextToSend, " Ping Reply");
            bDisablePONG = TRUE;
        }
        bDisablePING = FALSE;
        return TRUE;
    }
    if(strcmp(sNotifyCode, "PONG!") == 0 && strlen(sText) > 7)
    {
        if (!bDisablePONG) {
            DWORD ID;
            clock_t StartTime;
            ConvertHex((char*)sText, (unsigned int*)&StartTime);
            StartTime = ((clock() - StartTime) * 1000) / CLOCKS_PER_SEC;
            CloseHandle(CreateThread(NULL, 0, ShowResult, (void*)StartTime, 0, &ID));
        }
        bDisablePONG = FALSE;
        return TRUE;

    }
    return FALSE;

    return FALSE;
}



This post was edited on 07-07-2003 at 07:21 PM by Finn.
07-07-2003 07:21 PM
Profile PM Find Quote Report
surfichris
Former Admin
*****

Avatar

Posts: 2365
Reputation: 81
Joined: Mar 2002
RE: Ping? Pong! Plugin
I have nearly done one with times, just need to test it now.
07-08-2003 01:46 AM
Profile PM Find Quote Report
BooGhost
Veteran Member
*****

Avatar


Posts: 3186
Reputation: 10
37 / Male / Flag
Joined: May 2003
RE: Ping? Pong! Plugin
i'd love being a beta tester :P
07-08-2003 01:49 AM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
O.P. RE: Ping? Pong! Plugin
I've finished mine which says the time!!!

The previous sentence is false. The following sentence is true.
07-08-2003 06:11 AM
Profile PM Find Quote Report
trax
Junior Member
**


Posts: 27
Joined: Nov 2002
RE: Ping? Pong! Plugin
So what was the solution?
07-08-2003 06:26 AM
Profile E-Mail PM Find Quote Report
segosa
Community's Choice
*****


Posts: 1407
Reputation: 92
Joined: Feb 2003
O.P. RE: Ping? Pong! Plugin
http://shoutbox.menthix.net/showthread.php?tid=12546 have a look there
The previous sentence is false. The following sentence is true.
07-08-2003 06:43 AM
Profile PM Find Quote Report
Pages: (2): « First « 1 [ 2 ] Last »
« 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