From f56c7ac5e668acd8633e8c91b438fec506162fc2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 8 Oct 2023 15:35:54 +0300 Subject: YAMN: another bunch of services removed --- plugins/ExternalAPI/m_account.h | 1 - plugins/ExternalAPI/m_mails.h | 53 ------ plugins/ExternalAPI/m_protoplugin.h | 344 +++++++++++------------------------- plugins/ExternalAPI/m_yamn.h | 34 ---- 4 files changed, 100 insertions(+), 332 deletions(-) (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_account.h b/plugins/ExternalAPI/m_account.h index c316923cd3..c735fe083b 100644 --- a/plugins/ExternalAPI/m_account.h +++ b/plugins/ExternalAPI/m_account.h @@ -235,7 +235,6 @@ struct SWriteGuard struct CAccount { #define YAMN_ACCOUNTFILEVERSION 2 //version of standard file format (YAMN book file format) - #define YAMN_ACCOUNTVERSION 3 // If changes are made in this structure, version is changed. // So then YAMN does not initialzie your structure, if version does not matches. diff --git a/plugins/ExternalAPI/m_mails.h b/plugins/ExternalAPI/m_mails.h index ea53511b72..28c796ff67 100644 --- a/plugins/ExternalAPI/m_mails.h +++ b/plugins/ExternalAPI/m_mails.h @@ -67,7 +67,6 @@ struct CMimeItem // this is plugin-independent typedef struct CMailData { - #define YAMN_MAILDATAVERSION 3 DWORD Size = 0; int CP = -1; @@ -78,7 +77,6 @@ typedef struct CMailData typedef struct CMimeMsgQueue { -#define YAMN_MAILVERSION 3 char *ID; //The ID of mail. This ID identifies every mail in the account, so plugin should set it DWORD Number; @@ -144,57 +142,6 @@ typedef struct CMimeMsgQueue } YAMNMAIL,*HYAMNMAIL; #define LoadedMailData(x) (x->MailData!=nullptr) -// -//================================== YAMN MAIL SERVICES ================================== -// - -//CreateAccountMail Service -//Your plugin should call this to create new mail for your plugin. -//WPARAM- (CAccount *) Account handle -//LPARAM- CMailData version (use YAMN_MAILVERSION definition) -//returns pointer to (HYAMNMAIL) or pointer to your structure returned from imported NewMailFcnPtr, if implemented -#define MS_YAMN_CREATEACCOUNTMAIL "YAMN/Service/CreateMail" -#define CreateAccountMail(x) (HYAMNMAIL)CallService(MS_YAMN_CREATEACCOUNTMAIL,(WPARAM)x,(LPARAM)YAMN_MAILVERSION) - -//DeleteAccountMail Service -//Deletes plugin's mail from memory. You probably won't use this service, because it deletes only account -//without any synchronization. Use MS_YAMN_DELETEACCOUNT instead. Note that deleting mail is something like "this mail is -//not more in the account". -//WPARAM- (HYAMNPROTOPLUGIN) handle of plugin, which is going to delete mail -//LPARAM- (HYAMNMAIL) mail going to delete -//returns zero if failed, otherwise returns nonzero -#define MS_YAMN_DELETEACCOUNTMAIL "YAMN/Service/DeletePluginMail" -#define DeleteAccountMail(x,y) CallService(MS_YAMN_DELETEACCOUNTMAIL,(WPARAM)x,(LPARAM)y) - -//LoadMailData Service -//This service loads mail from standard YAMN storage (now it is 1 file, from which mails are loaded once at startup, but -//in the future it can be Miranda profile file or separate file (1 file per 1 mail). It depends on YAMN implementation... -//Use this function if you want to read or write to MailData member of mail structure. Please use synchronization obejcts -//before calling this service (so you must have read or write access to mails) -//WPARAM- (HYAMNMAIL) mail where to load data -//LPARAM- (DWORD) version of MAILDATA structure (use YAMN_MAILDATAVERSION definition) -//returns pointer to new allocated MailData structure (the same value as MailData member) -#define MS_YAMN_LOADMAILDATA "YAMN/Service/LoadMailData" -#define LoadMailData(x) (CMailData*)CallService(MS_YAMN_LOADMAILDATA,(WPARAM)x,(LPARAM)YAMN_MAILDATAVERSION) - -//UnloadMailData Service -//This service frees mail data from memory. It does not care if data were saved or not. So you should save mail before you -//release data from memory. -//WPARAM- (HYAMNMAIL) mail whose data are about to free -//LPARAM- nothing yet -//returns nonzero if success -#define MS_YAMN_UNLOADMAILDATA "YAMN/Service/UnloadMailData" -#define UnloadMailData(x) CallService(MS_YAMN_UNLOADMAILDATA,(WPARAM)x,0) - -//SaveMailData Service -//This service saves mail to standard YAMN storage (when using now 1 book file, it does nothing, because save is done when -//using MS_YAMN_WRITEACCOUNT service. In the future, mail can be saved to Miranda profile or to separate file...) -//WPARAM- (HYAMNMAIL) mail to save -//LPARAM- (DWORD) version of MAILDATA structure (use YAMN_MAILDATAVERSION definition) -//returns ZERO! if succes -#define MS_YAMN_SAVEMAILDATA "YAMN/Service/SaveMailData" -#define SaveMailData(x) CallService(MS_YAMN_SAVEMAILDATA,(WPARAM)x,(LPARAM)YAMN_MAILDATAVERSION) - // //================================== FUNCTIONS DEFINITIONS ======================================== // diff --git a/plugins/ExternalAPI/m_protoplugin.h b/plugins/ExternalAPI/m_protoplugin.h index c2085d25a0..633740b857 100644 --- a/plugins/ExternalAPI/m_protoplugin.h +++ b/plugins/ExternalAPI/m_protoplugin.h @@ -2,66 +2,66 @@ #define __M_PROTOPLUGIN_H #include -#include "m_account.h" //for account import functions -#include "m_mails.h" //for mail import functions +#include "m_account.h" // for account import functions +#include "m_mails.h" // for mail import functions -// -//================================== OTHER DEFINITIONS ======================================== -// +// +// ================================== OTHER DEFINITIONS ======================================== +// -//structure is used to give parameters to Check, Synchro or Timeout function +// structure is used to give parameters to Check, Synchro or Timeout function struct CheckParam { - //Your plugin should use this definition + // Your plugin should use this definition #define YAMN_CHECKVERSION 2 - //Version of this structure. Please verify your version in your plugin + // Version of this structure. Please verify your version in your plugin int Ver; - //Event that new Check thread must set to signal calling thread that "I've copied all parameters from stack" - //IMPORTANT!!!: Although version #defined in your plugin is not the same, your plugin MUST signal this event - //in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. + // Event that new Check thread must set to signal calling thread that "I've copied all parameters from stack" + // IMPORTANT!!!: Although version #defined in your plugin is not the same, your plugin MUST signal this event + // in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. HANDLE ThreadRunningEV; - //ActualAccount- the only parameter used in Check function and should contain all needed information I think :) + // ActualAccount- the only parameter used in Check function and should contain all needed information I think :) CAccount *AccountParam; - //I thought it, but this is needed, too + // I thought it, but this is needed, too #define YAMN_NORMALCHECK 0 #define YAMN_FORCECHECK 1 int Flags; - //YAMN writes here some informations that are needed to pass to mail browser function (or bad connection) + // YAMN writes here some informations that are needed to pass to mail browser function (or bad connection) void *BrowserParam; - //Calling thread (protocol plugin) can write here its own parameters. Usefull when protocol calls its own check function. YAMN always sets this parameter to NULL + // Calling thread (protocol plugin) can write here its own parameters. Usefull when protocol calls its own check function. YAMN always sets this parameter to NULL void *CustomParam; }; -//structure is used to give parameters to DeleteMails function +// structure is used to give parameters to DeleteMails function struct DeleteParam { - //Your plugin should use this definition + // Your plugin should use this definition #define YAMN_DELETEVERSION 1 - //Version of this structure. Please verify your version in your plugin + // Version of this structure. Please verify your version in your plugin DWORD Ver; - //Event that new Delete thread must set to signal calling thread that it copied all parameters from stack - //IMPORTANT!!!: Although version #defined in your plugin is not the same, your plugin MUST signal this event - //in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. + // Event that new Delete thread must set to signal calling thread that it copied all parameters from stack + // IMPORTANT!!!: Although version #defined in your plugin is not the same, your plugin MUST signal this event + // in any way. YAMN is waiting for this event. If you do not signal it, YAMN is blocked. HANDLE ThreadRunningEV; - //ActualAccount- which account to delete + // ActualAccount- which account to delete CAccount *AccountParam; - //YAMN writes here some informations that are needed to pass to mail browser function (or bad connection or no new mail) + // YAMN writes here some informations that are needed to pass to mail browser function (or bad connection or no new mail) void *BrowserParam; - //Calling thread can write here its own parameter. Usefull when protocol calls its own delete function. YAMN always sets this parameter to NULL + // Calling thread can write here its own parameter. Usefull when protocol calls its own delete function. YAMN always sets this parameter to NULL void *CustomParam; }; -// -//================================== IMPORTED FUNCTIONS ================================== -// +// +// ================================== IMPORTED FUNCTIONS ================================== +// #ifndef YAMN_STANDARDFCN typedef DWORD(WINAPI *YAMN_STANDARDFCN)(LPVOID); #endif typedef struct CYAMNVariables *(WINAPI *YAMN_GETVARIABLESFCN)(DWORD); -typedef CAccount *(WINAPI *YAMN_NEWACCOUNTFCN)(struct YAMN_PROTOPLUGIN *, DWORD); +typedef CAccount *(WINAPI *YAMN_NEWACCOUNTFCN)(struct YAMN_PROTOPLUGIN *); typedef void (WINAPI *YAMN_STOPACCOUNTFCN)(CAccount *); typedef void (WINAPI *YAMN_DELETEACCOUNTFCN)(CAccount *); typedef DWORD(WINAPI *YAMN_WRITEPLUGINOPTS)(HANDLE File, CAccount *); @@ -73,156 +73,146 @@ typedef char* (WINAPI *YAMN_GETERRORSTRINGAFCN)(DWORD); typedef void (WINAPI *YAMN_DELETEERRORSTRINGFCN)(LPVOID); typedef DWORD(WINAPI *YAMN_WRITEACCOUNTSFCN)(); -typedef struct CAccountImportFcn +struct YAMN_PROTOIMPORTFCN { - //If changes are made in this structure, version is changed. - //So then YAMN does not initialize your structure, if version does not match. -#define YAMN_PROTOIMPORTFCNVERSION 3 - - //Note: not all of these functions are needed to be implemented in your protocol plugin. Those - //functions, which are not implemented, you have to set to NULL. - - //Function is called to construct protocol defined account - //This is VERY IMPORTANT for YAMN and plugin to cooperate: - //Imagine following situation. YAMN wants to add new account (it is possible e.g. - //when loading accounts from file), so it has to call protocol constructor. - //It calls NewAccount function and plugin creates new account and returns - //its handle (pointer in fact). That means new account is created with plugin features - //(it is created inherited account, not base class). + // Note: not all of these functions are needed to be implemented in your protocol plugin. Those + // functions, which are not implemented, you have to set to NULL. + + // Function is called to construct protocol defined account + // This is VERY IMPORTANT for YAMN and plugin to cooperate: + // Imagine following situation. YAMN wants to add new account (it is possible e.g. + // when loading accounts from file), so it has to call protocol constructor. + // It calls NewAccount function and plugin creates new account and returns + // its handle (pointer in fact). That means new account is created with plugin features + // (it is created inherited account, not base class). YAMN_NEWACCOUNTFCN NewAccountFcnPtr; - //Function is called to delete protocol defined variables to inherited CAccount structure + // Function is called to delete protocol defined variables to inherited CAccount structure YAMN_DELETEACCOUNTFCN DeleteAccountFcnPtr; - //Function is called when user requests not tu run account longer. (E.g. when closing Miranda) + // Function is called when user requests not tu run account longer. (E.g. when closing Miranda) YAMN_STOPACCOUNTFCN StopAccountFcnPtr; - //Function is called when plugin should write its own info into book file + // Function is called when plugin should write its own info into book file YAMN_WRITEPLUGINOPTS WritePluginOptsFcnPtr; - //Function is called when plugin should read its own info from book file + // Function is called when plugin should read its own info from book file YAMN_READPLUGINOPTS ReadPluginOptsFcnPtr; - //Function is called to synchronise account (delete old mails and get the new ones) + // Function is called to synchronise account (delete old mails and get the new ones) YAMN_CHECKFCN SynchroFcnPtr; - //Function is called when timer timed out- it can be the same as SynchroFcnPtr + // Function is called when timer timed out- it can be the same as SynchroFcnPtr YAMN_CHECKFCN TimeoutFcnPtr; - //Function is called when forced checking- it can be the same as SynchroFcnPtr + // Function is called when forced checking- it can be the same as SynchroFcnPtr YAMN_CHECKFCN ForceCheckFcnPtr; - //Function is called when user wants to delete mails + // Function is called when user wants to delete mails YAMN_DELETEFCN DeleteMailsFcnPtr; - //Function is called when YAMN wants to get error description. Note the parameter given in - //this function is in fact the same as your CheckFcnPtr, DeleteMailsFcnPtr etc. returns to YAMN. - //If you want, you may return pointer to some structure, which includes more information about - //error than only one DWORD. And then, you can in your function create Unicode string containing - //all your error code. YAMN copies this string into its own buffer. Your error code and pointer - //can be deleted in DeleteErrorStringFcnPtr, which is called by YAMN + // Function is called when YAMN wants to get error description. Note the parameter given in + // this function is in fact the same as your CheckFcnPtr, DeleteMailsFcnPtr etc. returns to YAMN. + // If you want, you may return pointer to some structure, which includes more information about + // error than only one DWORD. And then, you can in your function create Unicode string containing + // all your error code. YAMN copies this string into its own buffer. Your error code and pointer + // can be deleted in DeleteErrorStringFcnPtr, which is called by YAMN YAMN_GETERRORSTRINGWFCN GetErrorStringWFcnPtr; - //This is the same as previous one, but plugin returns normal string (not Unicode). YAMN first - //looks, if your plugin has implemented GetErrorStringWFcnPtr. If not, it looks for this function - //So as you (of course) wait, you implemnt only one of these functions or no one of them. + // This is the same as previous one, but plugin returns normal string (not Unicode). YAMN first + // looks, if your plugin has implemented GetErrorStringWFcnPtr. If not, it looks for this function + // So as you (of course) wait, you implemnt only one of these functions or no one of them. YAMN_GETERRORSTRINGAFCN GetErrorStringAFcnPtr; - //Deletes error string that was allocated in your GetErrorStringXFcnPtr. Parameter to this fcn is - //Unicode or normal string. Therefore parameter is defined as LPVOID, but your plugin knows if it is - //Unicode or not... - //If NULL, YAMN does nothing with string + // Deletes error string that was allocated in your GetErrorStringXFcnPtr. Parameter to this fcn is + // Unicode or normal string. Therefore parameter is defined as LPVOID, but your plugin knows if it is + // Unicode or not... + // If NULL, YAMN does nothing with string YAMN_DELETEERRORSTRINGFCN DeleteErrorStringFcnPtr; - //Function is called to notify plugin, that it is quite good to store account status (and mails) + // Function is called to notify plugin, that it is quite good to store account status (and mails) YAMN_WRITEACCOUNTSFCN WriteAccountsFcnPtr; - //Function is called when user wants to view mails - //not used now, in the future + // Function is called when user wants to view mails + // not used now, in the future YAMN_STANDARDFCN ViewMailsFcnPtr; - //Function is called when application exits. Plugin should unload + // Function is called when application exits. Plugin should unload YAMN_STANDARDFCN UnLoadFcn; -} YAMN_PROTOIMPORTFCN, *PYAMN_PROTOIMPORTFCN; +}; -typedef HYAMNMAIL(WINAPI *YAMN_NEWMAILFCN)(CAccount *, DWORD); +typedef HYAMNMAIL(WINAPI *YAMN_NEWMAILFCN)(CAccount *); typedef void (WINAPI *YAMN_DELETEMAILFCN)(HYAMNMAIL); typedef DWORD(WINAPI *YAMN_WRITEMAILOPTS)(HANDLE File, HYAMNMAIL); typedef DWORD(WINAPI *YAMN_READMAILOPTS)(HYAMNMAIL, char **, char *); -typedef struct CMailImportFcn +struct YAMN_MAILIMPORTFCN { - //If changes are made in this structure, version is changed. - //So then YAMN does not initialize your structure, if version does not match. -#define YAMN_MAILIMPORTFCNVERSION 1 - - //Note: not all of these functions are needed to be implemented in your protocol plugin. Those - //functions, which are not implemented, you have to set to NULL. - - //Function is called to construct protocol defined account - //This is VERY IMPORTANT for YAMN and plugin to cooperate: - //Imagine following situation. YAMN wants to add new account (it is possible e.g. - //when loading accounts from file), so it has to call protocol constructor. - //It calls NewAccount function and plugin creates new account and returns - //its handle (pointer in fact). That means new account is created with plugin features - //(it is created inherited account, not base class). + // Note: not all of these functions are needed to be implemented in your protocol plugin. Those + // functions, which are not implemented, you have to set to NULL. + + // Function is called to construct protocol defined account + // This is VERY IMPORTANT for YAMN and plugin to cooperate: + // Imagine following situation. YAMN wants to add new account (it is possible e.g. + // when loading accounts from file), so it has to call protocol constructor. + // It calls NewAccount function and plugin creates new account and returns + // its handle (pointer in fact). That means new account is created with plugin features + // (it is created inherited account, not base class). YAMN_NEWMAILFCN NewMailFcnPtr; - //Function is called to delete protocol defined variables to inherited CAccount structure + // Function is called to delete protocol defined variables to inherited CAccount structure YAMN_DELETEMAILFCN DeleteMailFcnPtr; - //Function is called when plugin should write its own info into book file + // Function is called when plugin should write its own info into book file YAMN_WRITEMAILOPTS WriteMailOptsFcnPtr; - //Function is called when plugin should read its own info from book file + // Function is called when plugin should read its own info from book file YAMN_READMAILOPTS ReadMailOptsFcnPtr; -} YAMN_MAILIMPORTFCN, *PYAMN_MAILIMPORTFCN; +}; -// -//================================== PROTOCOL PLUGIN REGISTRATION STRUCTURES ================================== -// +// +// ================================== PROTOCOL PLUGIN REGISTRATION STRUCTURES ================================== +// -typedef struct CProtoPluginRegistration +struct YAMN_PROTOREGISTRATION { -#define YAMN_PROTOREGISTRATIONVERSION 1 - //Name of plugin - //this member CANNOT be NULL. Just write here description, i.e. "Yahoo Mail 1.2" + // Name of plugin + // this member CANNOT be NULL. Just write here description, i.e. "Yahoo Mail 1.2" char *Name; - //The version of plugin. CANNOT be NULL. + // The version of plugin. CANNOT be NULL. char *Ver; - //Plugin copyright - //Write here your copyright if you want (or NULL) + // Plugin copyright + // Write here your copyright if you want (or NULL) char *Copyright; - //Plugin description. Can be NULL. + // Plugin description. Can be NULL. char *Description; - //Your contact (email). Can be NULL. + // Your contact (email). Can be NULL. char *Email; - //The web page. Can be NULL. + // The web page. Can be NULL. char *WWW; - -} YAMN_PROTOREGISTRATION, *PYAMN_PROTOREGISTRATION; +}; struct YAMN_PROTOPLUGIN { // Pointer to first protocol plugin account - CAccount *FirstAccount; + CAccount *FirstAccount = 0; // We prevent browsing through accounts (chained list) from deleting or adding any account // If we want to delete or add, we must have "write" access to AccountBrowserSO // Note that accounts can be changed during AccountBrowser is in "read" mode, because we do not add or delete account. SWMRG AccountBrowserSO; - //All needed other info from plugin - PYAMN_PROTOREGISTRATION PluginInfo; + // All needed other info from plugin + YAMN_PROTOREGISTRATION *PluginInfo; - //Imported functions - PYAMN_PROTOIMPORTFCN Fcn; - PYAMN_MAILIMPORTFCN MailFcn; + // Imported functions + YAMN_PROTOIMPORTFCN *Fcn = 0; + YAMN_MAILIMPORTFCN *MailFcn = 0; }; struct YAMN_PROTOPLUGINQUEUE @@ -231,138 +221,4 @@ struct YAMN_PROTOPLUGINQUEUE YAMN_PROTOPLUGINQUEUE *Next; }; -// -//================================== YAMN SERVICES FOR PROTOCOL PLUGIN ================================== -// - -//RegisterProtoPlugin Service -//Your plugin can call this service to "connect to YAMN"- it means, that you -//give some parameters to YAMN and YAMN can then cooperate with your protocol plugins -//WPARAM- pointer to YAMN_PROTOREGISTRATION structure. Plugin must not delete this structure from memory. -//LPARAM- version of YAMN_PROTOREGISTRATION structure (use YAMN_PROTOREGISTRATIONVERSION definition) -//returns handle to plugin (HYAMNPROTOPLUGIN), if registration failed (plugin not registered) returns NULL -//Note, that your plugin should store returned plugin handle, because it will be usefull in next services. -//You need next to call SetProtocolPluginFcnImportFcn to have your plugin cooperated with YAMN. -#define MS_YAMN_REGISTERPROTOPLUGIN "YAMN/Service/RegisterProtocolPlugin" - -//UnregisterProtoPlugin Service -//Removes plugin from YAMN and deltes its structures -//WPARAM- (HYAMNPROTOPLUGIN) handle of protocol plugin -//LPARAM- any value -//returns nonzero if success -#define MS_YAMN_UNREGISTERPROTOPLUGIN "YAMN/Service/UnregisterProtocolPlugin" - -//CreateAccount Service -//Your plugin should call this to create new account for your plugin. -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- CAccount version (use YAMN_ACCOUNTVERSION definition) -//returns pointer to (CAccount *) or pointer to your structure returned from imported NewAccountFcnPtr, if implemented -#define MS_YAMN_CREATEPLUGINACCOUNT "YAMN/Service/CreateAccount" - -//DeletePluginAccount Service -//Deletes plugin's account from memory. You probably won't use this service, because it deletes only account -//without any synchronization. Use MS_YAMN_DELETEACCOUNT instead. -//WPARAM- (CAccount *) to delete -//LPARAM- any value -//returns zero if failed, otherwise returns nonzero -#define MS_YAMN_DELETEPLUGINACCOUNT "YAMN/Service/DeletePluginAccount" - -//FindAccountByName Service -//Searches accounts queue for first account that belongs to plugin -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- (TCHAR *)string, name of account to find -//returns found CAccount * handle or NULL if not found -#define MS_YAMN_FINDACCOUNTBYNAME "YAMN/Service/FindAccountByName" - -//GetNextFreeAccount Service -//Creates new account for plugin and adds it to plugin account queue. -//Note!!! you have to use AccountBrowserSO in your plugin before and after calling this service, because it is not synchronized -//So the normal way is like this: -// WaitToWriteSO(MyPlugin->AccountBrowserSO); -// CallService(MS_YAMN_GETNEXTFREEACCOUNT,MyPlugin,YAMN_ACCOUNTVERSION); -// WriteDoneSO(MyPlugin->AccountBrowserSO); -// -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- CAccount version (use YAMN_ACCOUNTVERSION definition) -//returns new CAccount * handle or NULL if not found -#define MS_YAMN_GETNEXTFREEACCOUNT "YAMN/Service/GetNextFreeAccount" - -//DeleteAccount Service -//Deletes account from plugin account queue. It also deletes it, but in background (when needed). -//This deleting is full synchronized and safe. It is recommended for plugins to use this service. -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- (CAccount *) Account to delete -#define MS_YAMN_DELETEACCOUNT "YAMN/Service/DeleteAccount" - -//ReadAccounts Service -//Reads standard accounts to file. Standard account means standard YAMN book format. -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- (TCHAR*)filename string. Put here your own desired filename. -//return value is one of the ones written in "account.h" file -#define MS_YAMN_READACCOUNTS "YAMN/Service/ReadAccounts" - -//WriteAccounts Service -//Writes standard accounts to file. Standard account means standard YAMN book format. It does not -//store special protocol features. It stores Account settings from CAccount struct and stores MIME mails -//from CMimeMsgQueue. If your Mails pointer does not point to CMimeMsgQueue structure, -//do not use this function. You are then forced to write your own function -//WPARAM- (HYAMNPLUGIN) Plugin handle -//LPARAM- (TCHAR*)filename string. Put here your own desired filename. -//return value is one of the ones written in "account.h" file -#define MS_YAMN_WRITEACCOUNTS "YAMN/Service/WriteAccounts" - -//GetFileName Service -//Function makes original filename, when you add your protocol string -//From "yahoo" makes "yamn-accounts.yahoo.xxxxx.book" filename -//It is good to use this fcn to have similar filenames... -//WPARAM- (TCHAR*) plugin string -//LPARAM- ignored -//returns NULL when failed, otherwise returns (TCHAR*)string (!!! not char *) to filename!!! -//You can use MS_YAMN_DELETEFILENAME service to release allocated filename from memory -#define MS_YAMN_GETFILENAME "YAMN/Service/GetFileName" - -//DeleteFileName Service -//deletes unicode string from memory -//WPARAM- (WCHAR *) pointer to unicode string -//LPARAM- any value -#define MS_YAMN_DELETEFILENAME "YAMN/Service/DeleteFileName" - -// -//================================== FUNCTIONS DEFINITIONS ======================================== -// - -typedef int (WINAPI *YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN)(YAMN_PROTOPLUGIN *Plugin, PYAMN_PROTOIMPORTFCN YAMNFcn, DWORD YAMNFcnVer, PYAMN_MAILIMPORTFCN YAMNMailFcn, DWORD YAMNMailFcnVer); - -// -//================================== QUICK FUNCTION CALL DEFINITIONS ======================================== -// - -//These are defininitions for YAMN exported functions. Your plugin can use them. -//pYAMNFcn is global variable, it is pointer to your structure containing YAMN functions. -//It is something similar like pluginLink variable in Miranda plugin. If you use -//this name of variable, you have already defined these functions and you can use them. -//It's similar to Miranda's CreateService function. - -//How to use YAMN functions: -//Create a structure containing pointer to functions you want to use in your plugin -//This structure can look something like this: -// -// struct -// { -// YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN SetProtocolPluginFcnImportFcn; -// } *pYAMNFcn; -// -//then you have to fill this structure with pointers... -// -// pYAMNFcn->SetProtocolPluginFcnImportFcn=(YAMN_SETPROTOCOLPLUGINFCNIMPORTFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SETPROTOCOLPLUGINFCNIMPORTID,0); -// -//and in your plugin just simply use e.g.: -// -// SetProtocolPluginFcnImport(...); -// - -#define YAMN_SETPROTOCOLPLUGINFCNIMPORTID "YAMN/SetProtocolPluginFcnImport" - -#define SetProtocolPluginFcnImport(a,b,c,d,e) pYAMNFcn->SetProtocolPluginFcnImportFcn(a,b,c,d,e) - #endif diff --git a/plugins/ExternalAPI/m_yamn.h b/plugins/ExternalAPI/m_yamn.h index 77ea3cb676..0b4a9f306d 100644 --- a/plugins/ExternalAPI/m_yamn.h +++ b/plugins/ExternalAPI/m_yamn.h @@ -15,22 +15,6 @@ struct YAMN_VARIABLES int Shutdown; }; -// -//================================== EXPORTED FUNCTIONS STRUCT =============================== -// - -struct CExportedFunctions -{ - char* ID; - void *Ptr; -}; - -struct CExportedServices -{ - char* ID; - INT_PTR (* Ptr)(WPARAM,LPARAM); -}; - // //================================== YAMN EVENTS ================================== // @@ -50,24 +34,6 @@ struct CExportedServices //================================== YAMN SERVICES ================================== // -//GetFcnPtr Service -//Your plugin can co-operate with YAMN in 2 ways: with Miranda services and with YAMN exported functions -//Some commands are written in services, some are functions. The advantage of function calling instead of -//service calling is, that your code is more clear and it is faster than service calling (smaller, FASTER, -//easier- it is slogan of Miranda, isn't it ?). Miranda service has only 2 parameters, that can be -//disadvantage too. -//In every way, it is discutable which functions should be exported or if they should be implemented as -//services. And if YAMN should export some functions etc. Functions not used very often are now implemented -//as Miranda services. -// -//This service gets pointer to YAMN function. Then you can use function directly. In m_?????.h files you have -//definitions of some functions, with definitions of structure variable, so you can use functions very -//clearly, just look to header file. -//WPARAM- function ID. It is string representating function you need to get pointer (e.g. YAMN_WRITEWAITID) -//LPARAM- not used now, but set it to 0 -//returns pointer to YAMN function or NULL when functions does not exist -#define MS_YAMN_GETFCNPTR "YAMN/Service/GetFcn" - //ForceCheck Service //Check mail on accounts //WPARAM- not used -- cgit v1.2.3