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;
}