From 5bf3fd51f1dcdd275d38f35d7aebe7bd063eb3db Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 16 Oct 2023 12:37:04 +0300 Subject: YAMN: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - fixes #3742 (YAMN: добавить опцию "игнорировать настройки всплывающих окон при ручной проверке"); - all manual calls of CreateThread() removed on behalf of mir_forkthread; - code cleaning --- plugins/ExternalAPI/m_account.h | 335 ------------------------------------ plugins/ExternalAPI/m_mails.h | 224 ------------------------ plugins/ExternalAPI/m_protoplugin.h | 215 ----------------------- 3 files changed, 774 deletions(-) delete mode 100644 plugins/ExternalAPI/m_account.h delete mode 100644 plugins/ExternalAPI/m_mails.h delete mode 100644 plugins/ExternalAPI/m_protoplugin.h (limited to 'plugins/ExternalAPI') diff --git a/plugins/ExternalAPI/m_account.h b/plugins/ExternalAPI/m_account.h deleted file mode 100644 index 11458828ce..0000000000 --- a/plugins/ExternalAPI/m_account.h +++ /dev/null @@ -1,335 +0,0 @@ -/* - * This file defines all needed parameters for one account. - * Other plugin can use this (so YAMN does not check it and another plugin can inform YAMN about new mail e.g.), - * this can be usefull for plugins like MSN (Hotmail notify) - * - * (c) majvan 2002-2004 - */ - -#ifndef __ACCOUNT_H -#define __ACCOUNT_H - -#include -#include - - // - //================================== OTHER DEFINITIONS ======================================== - // - -enum -{ - // Error codes returned from functions (services) working with account book files - EACC_SYSTEM = 1, //use GetLastError() to retrieve detailed information about error - EACC_ALLOC, //problem with memory allocation - EACC_FILECOMPATIBILITY, //file is corrupted - EACC_ENDOFFILE, //unexpected end of file occured - EACC_FILEVERSION, //file should be YAMN book format, but newer version that expected - EACC_FILESIZE, //file has wrong size -}; - -enum -{ - // Status of account - // used in messages WM_YAMN_CHANGESTATUS - // used also in function GetStatus and SetStatus - ACC_IDLE = 0, //account is IDLE (no work is performed with account) - ACC_FINDING, //DNS lookup for account - ACC_CONNECTING, //connecting in progress - ACC_LOGGING, //logging in progress - ACC_WORKING, //working - ACC_DISCONNECTING, //disconnecting from server -}; - -#define YAMN_ACC_MSG 0x00000002 // Shows dialog -#define YAMN_ACC_ICO 0x00000004 // Shows system tray icon (1) -#define YAMN_ACC_ICOB 0x00000008 // not used now, enables tray icon flashing (1) -#define YAMN_ACC_APP 0x00000010 // Runs application (1) -#define YAMN_ACC_POP 0x00000020 // Shows popup -#define YAMN_ACC_POPC 0x00000040 // Use custom colors in popup -#define YAMN_ACC_MSGP 0x00000080 // Persistant messgage. This means, when an situation occurs (e.g. new mail) and message is displayed, it is not destroyed when YAMN_ACC_MSG is not set -#define YAMN_ACC_KBN 0x00000100 // Use Keyboard notify -#define YAMN_ACC_CONT 0x00000200 // Use Contact notify -#define YAMN_ACC_CONTNICK 0x00000400 // Use Contact Nick replacement -#define YAMN_ACC_CONTNOEVENT 0x00000800 // Suppress event for this contact - -struct YAMN_NOTIFICATION -{ - //(1) - usable only in newmail notification - DWORD Flags = 0; - - COLORREF PopupB = 0; - COLORREF PopupT = 0; - DWORD PopupTime = 0; - WCHAR *App = nullptr; - WCHAR *AppParam = nullptr; - - // These parameters are not stored in standard YAMN book file and therefore must be set by plugin - char *Sound = nullptr; - HICON TrayIcon1 = nullptr; - HICON TrayIcon2 = nullptr; -}; - -struct CServer -{ - char *Name = nullptr; - DWORD Port = 0; - - char *Login = nullptr; - - // Password encryption definitions - #define STARTCODEPSW 0x50 - #define ADDCODEPSW 0x0 - char *Passwd = nullptr; -}; - -// -//================================== ACCOUNT DEFINITION ================================== -// - -#define WAIT_FINISH WAIT_OBJECT_0+1 - -// This structure is used to get semaphore-like synchronization: -// Includes incrementing, decrementing DWORD value and if DWORD is zero, sets event -class SCOUNTER -{ - HANDLE Event; - uint32_t Number = 0; - CRITICAL_SECTION CounterCS; - -public: - SCOUNTER(); - SCOUNTER(HANDLE InitializedEvent); - ~SCOUNTER(); - - __forceinline HANDLE GetEvent() const { return Event; } - - uint32_t GetNumber(); - uint32_t Inc(); - uint32_t Dec(); -}; - -struct SCGuard -{ - SCOUNTER &pSC; - - __forceinline SCGuard(SCOUNTER &sc) : - pSC(sc) - { - sc.Inc(); - } - - __forceinline ~SCGuard() - { - pSC.Dec(); - } -}; - -// The single-writer/multiple-reader guard -// compound synchronization object (SO) -// Notices: Copyright (c) 1995-1997 Jeffrey Richter -// Changes: majvan, only one process implementation, -// hFinishEV event added- signals when we do not want to use this SO anymore - -class SWMRG -{ - // This event guards access to the other objects - // managed by this data structure and also indicates - // whether any writer threads are writing. - HANDLE hEventNoWriter; - - // This manual-reset event is signaled when - // no reader threads are reading. - HANDLE hEventNoReaders; - - // This value is used simply as a counter. - // (the count is the number of reader threads) - HANDLE hSemNumReaders; - - // The request is for not to enter critical section - // for writing or reading due to going to delete guard - HANDLE hFinishEV; - -public: - SWMRG(wchar_t *Name = nullptr); - ~SWMRG(); - - uint32_t WaitToWrite(uint32_t dwTimeout = INFINITE); - void DoneWriting(); - - uint32_t WaitToRead(uint32_t dwTimeout = INFINITE); - void DoneReading(); - - void Stop() - { - ::SetEvent(hFinishEV); - } -}; - -struct SReadGuard -{ - SWMRG &pSO; - uint32_t dwError; - - SReadGuard(SWMRG &so, uint32_t timeout = INFINITE) : - pSO(so) - { - dwError = so.WaitToRead(timeout); - } - - ~SReadGuard() - { - Uninit(); - } - - bool Succeeded() const - { - return dwError == WAIT_OBJECT_0; - } - - void Uninit() - { - if (dwError == WAIT_OBJECT_0) { - pSO.DoneReading(); - dwError = WAIT_FINISH; - } - } - - operator uint32_t() const { return dwError; } -}; - -struct SWriteGuard -{ - SWMRG &pSO; - uint32_t dwError; - - SWriteGuard(SWMRG &so, uint32_t timeout = INFINITE) : - pSO(so) - { - dwError = so.WaitToWrite(timeout); - } - - ~SWriteGuard() - { - Uninit(); - } - - bool Succeeded() const - { - return dwError == WAIT_OBJECT_0; - } - - void Uninit() - { - if (dwError == WAIT_OBJECT_0) { - pSO.DoneWriting(); - dwError = WAIT_FINISH; - } - } - - operator uint32_t() const { return dwError; } -}; - -///////////////////////////////////////////////////////////////////////////////////////// -// CAccount - basic email account class - -struct CAccount : public MZeroedObject -{ - #define YAMN_ACCOUNTFILEVERSION 2 //version of standard file format (YAMN book file format) - - // If changes are made in this structure, version is changed. - // So then YAMN does not initialzie your structure, if version does not matches. - - BOOL AbleToWork; // This is set to TRUE by default. When it is needed to stop working on this account, YAMN sets this to zero. - - struct YAMN_PROTOPLUGIN *Plugin; // free access, because this member should not be changed. The same as YAMN_PLUGIN structure - - char *Name; // access only through AccountAccessSO - - CServer *Server; //access only through AccountAccessSO - - WORD Interval; //access only through AccountAccessSO - - // YAMN account flags (set by user) - #define YAMN_ACC_ENA 0x00000001 //Enables account. If account is disabled, no countdown is performed - #define YAMN_ACC_POPN 0x00000002 //Shows one popup per one new mail or for N mails - #define YAMN_ACC_APOP 0x00000004 //Use APOP authentication - #define YAMN_ACC_SSL23 0x00000008 //Use SSLv2,3 - #define YAMN_ACC_NOTLS 0x00000010 //Don't try StartTLS (STLS) even available - #define YAMN_ACC_BODY 0x00000020 //Always retrieve body of the message - DWORD Flags; //access only through AccountAccessSO - - // YAMN account flags (set by plugin) - #define YAMN_ACC_BROWSE 0x00000001 //Can browse mails. On this account we can run mailbrowser window - #define YAMN_ACC_POPUP 0x00000002 //Popups of new mail belonging to this account can be showed - DWORD AbilityFlags; - - // YAMN account status flags - #define YAMN_ACC_ST0 0x00000001 // Check (countdown) when Offline - #define YAMN_ACC_ST1 0x00000002 // Check (countdown) when Online - #define YAMN_ACC_ST2 0x00000004 // Check (countdown) when Away - #define YAMN_ACC_ST3 0x00000008 // Check (countdown) when Not available - #define YAMN_ACC_ST4 0x00000010 // Check (countdown) when Occupied - #define YAMN_ACC_ST5 0x00000020 // Check (countdown) when DND - #define YAMN_ACC_ST6 0x00000040 // Check (countdown) when Free for chat - #define YAMN_ACC_ST7 0x00000080 // Check (countdown) when Invisible - - #define YAMN_ACC_STARTA 0x00010000 // Check on start anyway - #define YAMN_ACC_STARTS 0x00020000 // Check on start regarding to status setting - #define YAMN_ACC_FORCE 0x00040000 // Check when "check new mail" item pressed (it is called forced checking) - DWORD StatusFlags; // access only through AccountAccessSO - - // Plugin flags. Use this DWORD if you want YAMN to store it to YAMN book file. You can set here any value - DWORD PluginFlags; - - YAMN_NOTIFICATION NewMailN; //access only through AccountAccessSO - YAMN_NOTIFICATION NoNewMailN; //access only through AccountAccessSO - YAMN_NOTIFICATION BadConnectN; //access only through AccountAccessSO - - SYSTEMTIME LastChecked; //last check, access only through AccountAccessSO - SYSTEMTIME LastSChecked; //last check (successfull), access only through AccountAccessSO - SYSTEMTIME LastSynchronised; //last synchronisation (successfull), access only through AccountAccessSO - SYSTEMTIME LastMail; //last check when new mail detected, access only through AccountAccessSO - - TCHAR Status[255]; //access only through GetStatusFcn() and SetStatusFcn() functions - - DWORD TimeLeft; //access only through AccountAccessSO - - HANDLE Mails; //access only through MessagesAccessSO - - // Account members are mostly the same, but there can be protocol (POP3,IMAP...) special features. - // To use them, only inherit this class and add your own features. - // First idea was to add pointer to void, where plugin can store its own values. - // But this solution is better in my opinion. - - // This is event with counter. Event is signaled when no threads are using account (and will not be using) - // Very usefull for account delete operation - SCOUNTER UsingThreads; - - // We have to achieve, that only one thread can write to account and more threads can read. - // Writing to account means that we change account parameters - // Reading from account meands we read account parameters - // Use WaitToRead(), ReadDone(), WaitToWrite(), WriteDone() synchronization functions - // For plugins, this is a pointer to void. It does not matter for plugin what is this variable for, - // because plugin works only with synchronization routines. And why is this void * ? It is because - // plugin does not need to include headers for SWMRG structures... - SWMRG AccountAccessSO; - - // We have to achieve, that only one thread can write to account mails and more threads can read. - // While some thread writes mails, other thread can write to account. This can be small problem, but it never appears in YAMN. - // But you should think about this note if you want to add some features in the future - // Writing to messages means any changes to message queue or message data - // Reading from messages means reading message queue (browsing through all messages) or reading message data - // Use MsgsWaitToRead(),MsgsReadDone(),MsgsWaitToWrite(),MsgsWriteDone() synchronization functions - SWMRG MessagesAccessSO; - - //For clist contact notification - MCONTACT hContact; - BOOL isCounting; - - CAccount *Next; - - void CheckMail(); - void RefreshContact(); -}; - -#endif diff --git a/plugins/ExternalAPI/m_mails.h b/plugins/ExternalAPI/m_mails.h deleted file mode 100644 index 7b765273f4..0000000000 --- a/plugins/ExternalAPI/m_mails.h +++ /dev/null @@ -1,224 +0,0 @@ -#ifndef __MAILS_H -#define __MAILS_H - -#include -#include -#include "m_account.h" - -// -//================================== OTHER DEFINITIONS ======================================== -// - -struct CShortNames -{ - char *Value; - char *ValueNick; - CShortNames *Next; -}; - -struct CMimeNames -{ - WCHAR *Value; - WCHAR *ValueNick; - CMimeNames *Next; -}; - -//this header is used in to get non-unicode data from mime header -struct CShortHeader -{ - char *From; - char *FromNick; - char *ReturnPath; - char *ReturnPathNick; - char *Subject; - CShortNames *To; - CShortNames *Cc; - CShortNames *Bcc; - char *Date; - char Priority; - char *Body; - - int CP; -}; - -//this header is used in miranda to store final results of mime reading in Unicode -struct CHeader -{ - ~CHeader(); - - CMStringW wszFrom; - CMStringW wszFromNick; - CMStringW wszReturnPath; - CMStringW wszReturnPathNick; - CMStringW wszSubject; - CMimeNames *To = 0; - CMimeNames *Cc = 0; - CMimeNames *Bcc = 0; - CMStringW wszDate; - TCHAR Priority = 0; - CMStringW wszBody; -}; - -struct CMimeItem -{ - char *name = nullptr; - char *value = nullptr; - CMimeItem *Next = nullptr; -}; - -// this is plugin-independent -typedef struct CMailData -{ - DWORD Size = 0; - int CP = -1; - - CMimeItem *TranslatedHeader = nullptr; // MIME items - CMimeItem *Additional = nullptr; // MIME items not read from server (custom, for filter plugins etc.) - char *Body = nullptr; // Message body -}; - -typedef struct CMimeMsgQueue -{ - char *ID; //The ID of mail. This ID identifies every mail in the account, so plugin should set it - - DWORD Number; - -#define YAMN_MSG_ANY 0xffffffff //any mail - -//The difference between new and unseen: when new mail is found in account, it becomes unseen and new. But in the next check, if the same mail is found, it is not new. -//However, when user was not near computer, he does not know about this mail- it is unseen. After user accepts, that he saw new mails, it becomes seen. -#define YAMN_MSG_NEW 0x80000000 //this mail is new -#define YAMN_MSG_UNSEEN 0x40000000 //this mail is mailbrowser unseen -#define YAMN_MSG_DISPLAY 0x20000000 //this mail can be displayed in mailbrowser -#define YAMN_MSG_POPUP 0x10000000 //this mail can be displayed in popup and can invoke a popup -#define YAMN_MSG_SYSTRAY 0x08000000 //this mail can invoke systray icon -#define YAMN_MSG_BROWSER 0x04000000 //this mail can run mailbrowser -#define YAMN_MSG_DISPLAYC 0x02000000 //this mail is inserted to browser mail counter system (the "Account - xx new mails, yy total" phrase) -#define YAMN_MSG_POPUPC 0x01000000 //this mail is inserted to popup counter system (the "Account - xx new mails, yy total" phrase) - -#define YAMN_MSG_SOUND 0x00800000 //this mail can "play sound" -#define YAMN_MSG_APP 0x00400000 //this mail can "launch application" -#define YAMN_MSG_NEVENT 0x00100000 //this mail can launch Miranda "new mail" event - -#define YAMN_MSG_VIRTUAL 0x00080000 //this mail is not real- does not exists - -#define YAMN_MSG_FILTERED 0x00040000 //this mail has been filtered - -#define YAMN_MSG_DELETETRASH 0x00020000 //this mail should be moved to the trash bin rather than really deleting from mailbox (this is only switch doing nothing, perhaps usefull for filter plugins) -#define YAMN_MSG_DELETED 0x00010000 //this mail is already deleted from server (also must be set virtual flag) (when doing synchronizations between 2 queues, YAMN then does not touch this mail) -#define YAMN_MSG_MEMDELETE 0x00008000 //this mail will be deleted immidiatelly from memory (and disk) when deleted from server (some opposite of YAMN_MSG_DELETED) -#define YAMN_MSG_USERDELETE 0x00004000 //this mail is about to delete from server (user deletes manually) -#define YAMN_MSG_AUTODELETE 0x00002000 //this mail is about to delete from server (plugin marks it for deleting) -#define YAMN_MSG_DELETEOK 0x00001000 //this mail is confirmed to delete (this flag must be set to delete this mail) - -#define YAMN_MSG_BODYREQUESTED 0x00000800 //user requested (part of) the body. In POP3 it should be (TOP ) -#define YAMN_MSG_BODYRECEIVED 0x00000200 //(part of) the body.received; -#define YAMN_MSG_STAYUNSEEN 0x00000400 //this mail stays unseen while user does not really see it - -#define YAMN_MSG_DELETE (YAMN_MSG_USERDELETE | YAMN_MSG_AUTODELETE) - -#define YAMN_MSG_NORMALNEW (YAMN_MSG_NEW | YAMN_MSG_UNSEEN | YAMN_MSG_BROWSER | YAMN_MSG_DISPLAY | YAMN_MSG_DISPLAYC | YAMN_MSG_POPUP | YAMN_MSG_POPUPC | YAMN_MSG_SYSTRAY | YAMN_MSG_SOUND | YAMN_MSG_APP | YAMN_MSG_NEVENT | YAMN_MSG_MEMDELETE | YAMN_MSG_STAYUNSEEN) - -#define YAMN_MSG_FLAGSSET(maildata,flag) ((maildata & flag)==flag) - -#define YAMN_MSG_SPAML1 1 //spam level 1: notify, show in another color in mail browser -#define YAMN_MSG_SPAML2 2 //spam level 2: do not notify, show in another color in mail browser -#define YAMN_MSG_SPAML3 3 //spam level 3: delete, show in another color in mail browser that it was deleted, you do not need to set YAMN_MSG_AUTODELETE -#define YAMN_MSG_SPAML4 4 //spam level 4: delete, do not show, you do not need to set YAMN_MSG_AUTODELETE -#define YAMN_MSG_SPAMMASK 0x0000000F - -#define YAMN_MSG_SPAML(maildata,level) ((maildata & YAMN_MSG_SPAMMASK)==level) - DWORD Flags; -//Plugins can read mail data, but it can be NULL!!! So plugin should use Load and Save services to load or save data and Unload to release data from memory - CMailData *MailData; -//Here YAMN stores its own informations about this mail. Not usefull for plugins... -// void *YAMNData; - HWND MsgWindow; -//plugins can store here its own data - void *PluginData; - - CMimeMsgQueue(): ID(nullptr), Number(0), Flags(0), MailData(nullptr), MsgWindow(nullptr), PluginData(nullptr), Next(nullptr){} - ~CMimeMsgQueue() {} - - struct CMimeMsgQueue *Next; -} YAMNMAIL,*HYAMNMAIL; -#define LoadedMailData(x) (x->MailData!=nullptr) - -// -//================================== FUNCTIONS DEFINITIONS ======================================== -// - -//typedef void (WINAPI *YAMN_SENDMESSAGEFCN)(UINT,WPARAM,LPARAM); -typedef void (WINAPI *YAMN_SYNCHROMIMEMSGSFCN)(CAccount *,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *,HYAMNMAIL *); -typedef void (WINAPI *YAMN_TRANSLATEHEADERFCN)(char *,int,struct CMimeItem **); -typedef void (WINAPI *YAMN_APPENDQUEUEFCN)(HYAMNMAIL,HYAMNMAIL); -typedef void (WINAPI *YAMN_DELETEMIMEQUEUEFCN)(CAccount *,HYAMNMAIL); -typedef void (WINAPI *YAMN_DELETEMIMEMESSAGEFCN)(HYAMNMAIL *,HYAMNMAIL,int); -typedef HYAMNMAIL (WINAPI *YAMN_FINDMIMEMESSAGEFCN)(HYAMNMAIL,char *); -typedef HYAMNMAIL (WINAPI *YAMN_CREATENEWDELETEQUEUEFCN)(HYAMNMAIL); -typedef void (WINAPI *YAMN_SETREMOVEQUEUEFLAGSFCN)(HYAMNMAIL,DWORD,DWORD,DWORD,int); - -// -//================================== 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_SYNCHROMIMEMSGSFCN SynchroMessagesFcn; -// YAMN_APPENDQUEUEFCN AppendQueueFcn; -// } *pYAMNMailFcn; -// -//then you have to fill this structure with pointers... -//you have to use YAMN service to get pointer, like this (I wrote here all functions you may need, -//you can copy to your sources only those you need): -// -// pYAMNMailFcn->SynchroMessagesFcn=(YAMN_SYNCHROMIMEMSGSFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SYNCHROMIMEMSGSID,0); -// pYAMNMailFcn->TranslateHeaderFcn=(YAMN_TRANSLATEHEADERFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_TRANSLATEHEADERID,0); -// pYAMNMailFcn->AppendQueueFcn=(YAMN_APPENDQUEUEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_APPENDQUEUEID,0); -// pYAMNMailFcn->DeleteMessagesToEndFcn=(YAMN_DELETEMIMEQUEUEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_DELETEMIMEQUEUEID,0); -// pYAMNMailFcn->DeleteMessageFromQueueFcn=(YAMN_DELETEMIMEMESSAGEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_DELETEMIMEMESSAGEID,0); -// pYAMNMailFcn->FindMessageByIDFcn=(YAMN_FINDMIMEMESSAGEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_FINDMIMEMESSAGEID,0); -// pYAMNMailFcn->CreateNewDeleteQueueFcn=(YAMN_CREATENEWDELETEQUEUEFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_CREATENEWDELETEQUEUEID,0); -// pYAMNMailFcn->SetRemoveQueueFlagsFcn=(YAMN_SETREMOVEQUEUEFLAGSFCN)CallService(MS_YAMN_GETFCNPTR,(WPARAM)YAMN_SETREMOVEQUEUEFLAGSID,0); -// -// -//and in your plugin just simply use e.g.: -// -// DeleteMIMEQueue(MyAccount,OldMessages); //this command deletes all messages in the mail queue OldMessages -// - -#define YAMN_SYNCHROMIMEMSGSID "YAMN/SynchroMessages" -#define YAMN_TRANSLATEHEADERID "YAMN/TranslateHeader" -#define YAMN_APPENDQUEUEID "YAMN/AppendQueue" -#define YAMN_DELETEMIMEQUEUEID "YAMN/DeleteMIMEQueue" -#define YAMN_DELETEMIMEMESSAGEID "YAMN/DeleteMIMEMessage" -#define YAMN_FINDMIMEMESSAGEID "YAMN/FindMIMEMessageByID" -#define YAMN_CREATENEWDELETEQUEUEID "YAMN/CreateNewDeleteQueue" -#define YAMN_SETREMOVEQUEUEFLAGSID "YAMN/SetRemoveQueueFlags" - -#define YAMN_FLAG_REMOVE 0 -#define YAMN_FLAG_SET 1 - - -#define SynchroMessages(a,b,c,d,e) pYAMNMailFcn->SynchroMessagesFcn(a,b,c,d,e) -#define TranslateHeader(a,b,c) pYAMNMailFcn->TranslateHeaderFcn(a,b,c) -#define AppendQueue(x,y) pYAMNMailFcn->AppendQueueFcn(x,y) -#define DeleteMIMEQueue(x,y) pYAMNMailFcn->DeleteMessagesToEndFcn(x,y) -#define DeleteMIMEMessage(x,y) pYAMNMailFcn->DeleteMessageFromQueueFcn(x,y,0) -#define DeleteMIMEMessageEx(x,y,z) pYAMNMailFcn->DeleteMessageFromQueueFcn(x,y,z) -#define FindMIMEMessageByID(x,y) pYAMNMailFcn->FindMessageByIDFcn(x,y) -#define CreateNewDeleteQueue(x) pYAMNMailFcn->CreateNewDeleteQueueFcn(x) -#define SetQueueFlags(a,b,c,d) pYAMNMailFcn->SetRemoveQueueFlagsFcn(a,b,c,d,1) -#define RemoveQueueFlags(a,b,c,d) pYAMNMailFcn->SetRemoveQueueFlagsFcn(a,b,c,d,0) - -#endif diff --git a/plugins/ExternalAPI/m_protoplugin.h b/plugins/ExternalAPI/m_protoplugin.h deleted file mode 100644 index d651563882..0000000000 --- a/plugins/ExternalAPI/m_protoplugin.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef __M_PROTOPLUGIN_H -#define __M_PROTOPLUGIN_H - -#include -#include "m_account.h" // for account import functions -#include "m_mails.h" // for mail import functions - -// -// ================================== OTHER DEFINITIONS ======================================== -// - -// structure is used to give parameters to Check, Synchro or Timeout function -struct CheckParam -{ - // Your plugin should use this definition -#define YAMN_CHECKVERSION 2 - // 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. - HANDLE ThreadRunningEV; - - // ActualAccount- the only parameter used in Check function and should contain all needed information I think :) - CAccount *AccountParam; -}; - -// structure is used to give parameters to DeleteMails function -struct DeleteParam -{ - // Your plugin should use this definition -#define YAMN_DELETEVERSION 1 - // 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. - HANDLE ThreadRunningEV; - // 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) - 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 - void *CustomParam; -}; - -// -// ================================== 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 *); -typedef void (WINAPI *YAMN_STOPACCOUNTFCN)(CAccount *); -typedef void (WINAPI *YAMN_DELETEACCOUNTFCN)(CAccount *); -typedef DWORD(WINAPI *YAMN_WRITEPLUGINOPTS)(HANDLE File, CAccount *); -typedef DWORD(WINAPI *YAMN_READPLUGINOPTS)(CAccount *, char **, char *); -typedef DWORD(WINAPI *YAMN_CHECKFCN)(struct CheckParam *); -typedef void(__cdecl *YAMN_DELETEFCN)(void *); -typedef TCHAR* (WINAPI *YAMN_GETERRORSTRINGWFCN)(DWORD); -typedef char* (WINAPI *YAMN_GETERRORSTRINGAFCN)(DWORD); -typedef void (WINAPI *YAMN_DELETEERRORSTRINGFCN)(LPVOID); -typedef DWORD(WINAPI *YAMN_WRITEACCOUNTSFCN)(); - -struct YAMN_PROTOIMPORTFCN -{ - // 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 - YAMN_DELETEACCOUNTFCN DeleteAccountFcnPtr; - - // 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 - YAMN_WRITEPLUGINOPTS WritePluginOptsFcnPtr; - - // 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) - YAMN_CHECKFCN 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 - YAMN_CHECKFCN ForceCheckFcnPtr; - - // 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 - 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. - 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 - YAMN_DELETEERRORSTRINGFCN DeleteErrorStringFcnPtr; - - // 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 - YAMN_STANDARDFCN ViewMailsFcnPtr; - - // Function is called when application exits. Plugin should unload - YAMN_STANDARDFCN UnLoadFcn; -}; - -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 *); - -struct YAMN_MAILIMPORTFCN -{ - // 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 - YAMN_DELETEMAILFCN DeleteMailFcnPtr; - - // 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 - YAMN_READMAILOPTS ReadMailOptsFcnPtr; -}; - -// -// ================================== PROTOCOL PLUGIN REGISTRATION STRUCTURES ================================== -// - -struct YAMN_PROTOREGISTRATION -{ - // 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. - char *Ver; - - // Plugin copyright - // Write here your copyright if you want (or NULL) - char *Copyright; - - // Plugin description. Can be NULL. - char *Description; - - // Your contact (email). Can be NULL. - char *Email; - - // The web page. Can be NULL. - char *WWW; -}; - -struct YAMN_PROTOPLUGIN -{ - // Pointer to first protocol plugin account - 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 - YAMN_PROTOREGISTRATION *PluginInfo; - - // Imported functions - YAMN_PROTOIMPORTFCN *Fcn = 0; - YAMN_MAILIMPORTFCN *MailFcn = 0; -}; - -struct YAMN_PROTOPLUGINQUEUE -{ - YAMN_PROTOPLUGIN *Plugin; - YAMN_PROTOPLUGINQUEUE *Next; -}; - -#endif -- cgit v1.2.3