-----BEGIN PGP SIGNED MESSAGE-----
Hola TBTECH,
Pues este es el primer intento de plugin que hayo en C, lenguaje
mas extendido :-)
Respete el idioma, y como no se aceptan adjuntos, lo incluyo
abajo
tbspamapi.h
==============
#include <windows.h>
/*
TheBat Anti-Spam Plugin API
Written by Robert Rainwater
Methods you must implement:
BOOL WINAPI DllMain(HINSTANCE hinstance,DWORD reason,LPVOID lp)
- ---------------------------------------------------------------
WINAPI function required to create the dll.
Example:
BOOL WINAPI DllMain(HINSTANCE hinstance,DWORD reason,LPVOID lp) {
hInst = hinstance; // hInst is a global variable
switch(reason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
int TBP_EXPORT TBP_GetName(char *dest, int size)
- ------------------------------------------------
Returns the amount of bytes copied to dest and sets the name. This function
uses the same format as other function that pass a string and size: if the
dest is NULL or size is 0, return length of the string (aka name), otherwise
copy size bytes of the source string into dest. TBSGetString is inlined
inside of this header file for you to use.
Example:
int TBP_EXPORT TBP_GetName(char *dest, int size) {
return TBSGetString("My Plugin",dest,size);
}
int TBP_EXPORT TBP_GetVersion(char *dest, int size)
- ---------------------------------------------------
Same as TBP_GetName expect you set the version string.
Example:
int TBP_EXPORT TBP_GetName(char *dest, int size) {
return TBSGetString("1.0",dest,size);
}
int TBP_EXPORT TBP_GetStatus()
- ------------------------------
This function should return 0 if everything is OK. Otherwise, it
should return an error code (which will be processed in future).
int TBP_EXPORT TBP_NeedConfig()
- -------------------------------
If your plugin supports configuration/setup, return 1, otherwise return
0. Returning 1 means that TBP_Setup will be called when the plugin
is "configured".
int TBP_EXPORT TBP_NeedCOM()
- ----------------------------
???
int TBP_EXPORT TBP_Setup()
- --------------------------
If you support setup (aka return 1 in TBP_NeedConfig), then you should return
1 if you made a change and 0 otherwise. Note: I have not found this to
be the case. In my test, configure is called immediately when adding
and if you return 1, the plugin failed to load. This may be due to a bug in
The Bat!.
int TBS_EXPORT TBP_GetSpamScore(int msgid, TBPGetDataProc dataProc)
- -------------------------------------------------------------------
This method should return the "score" of the message with the given message id.
You should use the dataProc function to retrieve the message information. The
object being passed should be the actual "method" you should use.
Information on TBPGetDataProc
- -----------------------------
TBPGetDataProc takes 4 parameters:
int msgid // msgid passed to TBP_GetSpamScore
int dataid // id of one of the #defines used to set which info to get
char *dest // a string for which you have allocated atleast size bytes
int size // amount of bytes to copy
TBPGetDataProc is similar to TBSGetString in that you should first pass NULL as
the dest and 0 as the size and test the return to make sure that information exists
(it should return more than 0 if valid). Example:
// GetData is of type
char buf[256];
if (dataProc(msgid,mpidMessageSubject,NULL,0)>0) {
dataProc(msgid,mpidMessageSubject,buf,sizeof(buf)-1);
// now buf contains the subject so you can do what you wish with it to get a
score, etc.
}
*/
#define TBP_EXPORT __declspec(dllexport)
typedef int (* TBPGetDataProc)(int,int,char*,int);
#define midxSubject 1;
#define midxDate 2;
#define midxComment 3;
#define midxInReplyTo 4;
#define midxMessageID 5;
#define midxNewsgroups 6;
#define midxMailer 7;
#define midxContentType 8;
#define midxContentSubType 9;
#define midxExpireDate 10;
#define midxOrganization 11;
#define midxContentID 12;
#define midxContentMD5 13;
#define midxPriority 14;
#define midxImportance 15;
#define midxContentLocation 16;
#define midxEncoding 17;
#define midxCharset 18;
#define midxBoundary 19;
#define midxMsgEncoding 20;
#define midxC_Name 21;
#define midxCD_Name 22;
#define midxReportType 23;
#define midxReferences 24;
#define midxC_Description 25;
#define midxContentDisposition 26;
#define midxContentLanguage 27;
#define midxC_ID 29;
#define midxC_AccessType 30;
#define midxC_Expiration 31;
#define midxC_Size 32;
#define midxC_Permission 33;
#define midxC_Site 34;
#define midxC_Directory 35;
#define midxC_Mode 36;
#define midxC_Server 37;
#define midxC_Subject 38;
#define midx_Files 39;
#define midx_Msgs 40;
#define midxReturnPath 41;
#define midxFromName 42;
#define midxFromAddr 43;
#define midxReplyName 44;
#define midxReplyAddr 45;
#define midxToName 46;
#define midxToAddr 47;
#define midxServerID 48;
#define midxRRC 49;
#define midxRRQ 50;
#define midxFileSubst 51;
#define midxC_Number 52;
#define midxC_Total 53;
#define midxXCFile 54;
#define midxMDN_To 55;
#define midxMDN_Options 56;
#define midxRefList 57;
#define midxC_MICAlg 58;
#define midxC_SMIMEType 59;
#define midxC_Protocol 60;
#define midxC_ProtocolType 61;
#define midxC_ProtocolSubType 62;
#define midxMatter 63;
#define midxListHelp 64;
#define midxListUnsub 65;
#define midxListSub 66;
#define midxListPost 67;
#define midxListOwner 68;
#define midxListArchive 69;
#define midxDecodedFrom 70;
#define midxDecodedTo 71;
#define midxDecodedSubj 72;
#define midxDecodedToEtc 73;
#define mpidMessageHeader 100000; // raw message RFC 822 header
#define mpidMessageBody 100001; // decoded message body (not available
yet)
#define mpidMessageAttachments 100002; // a CR-delimited list of attachments
#define mpidMessageSender 100003; // decoded message sender (FROM)
#define mpidMessageSubject 100004; // decoded message subject
#define mpidRawMessage 100005; // raw message body
static int __inline TBPGetString(char *src, char *dest, int size) {
if (dest==NULL || size<=0) return lstrlen(src);
if (size>lstrlen(src)) size = lstrlen(src);
if (size>0) {
lstrcpyn(dest,src,size+1); // (size+1) = (size) + (null character)
return size;
}
return 0;
}
===============
Ley de Jay: Para los directivos, cambiar las cosas es fundamental, y cambiarlas
antes que otras personas es el colmo de la creatividad
- --
-=To�o.!=-
La injusticia de la vida es algo que cuestiono cada vez que pienso en la suerte que
he tenido al conocerte. junior1
____,,, (^;^) ,,,__________________________
-=To�o.!=-
ICQ-UIN:50036143
Llave PGP http://a_mi_go_.4d2.net
______w______w_____________________________
-----BEGIN PGP SIGNATURE-----
Version: "Firmado sellado con PGP/GPG y entregado por -=To�o.!=-"
Comment: Apasionate y Apasiona
iQCVAwUBPihetoPdrd6lx+FTAQGS6gP/V5aiZ5RDymvaVQ57J67PHTCmvLQ6a2Cg
PpEKC1j/aFL7CVI7Q/xy+YyX9Ji2FITiwzDlaqJfITeOgoOQMcZefhO0iO8wFHxc
lMrjmcHcLboxAJHYOmv6Cd3ZmG1txRsRZNgKWcOLTm/3piVsUYdPEuO4QWNGVl4j
VjSTNhe9ZUo=
=81Qg
-----END PGP SIGNATURE-----
________________________________________________________
Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html