diff options
author | George Hazan <george.hazan@gmail.com> | 2012-05-27 19:56:57 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-05-27 19:56:57 +0000 |
commit | 69979c145ec7d6c843635aedd0dc57158ec866d1 (patch) | |
tree | b14fe6d3676080cf950cb97e4354d3618b118e6a | |
parent | bc62befe65f4ff950bb192d703fb38a9336d5a51 (diff) |
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@201 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/ExternalAPI/m_protoplugin.h | 47 | ||||
-rw-r--r-- | protocols/GTalkExt/inbox.cpp | 54 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 6 |
3 files changed, 42 insertions, 65 deletions
diff --git a/plugins/ExternalAPI/m_protoplugin.h b/plugins/ExternalAPI/m_protoplugin.h index 0136c28f21..08e3e0efb9 100644 --- a/plugins/ExternalAPI/m_protoplugin.h +++ b/plugins/ExternalAPI/m_protoplugin.h @@ -68,7 +68,7 @@ typedef DWORD (WINAPI *YAMN_WRITEPLUGINOPTS)(HANDLE File,HACCOUNT); typedef DWORD (WINAPI *YAMN_READPLUGINOPTS)(HACCOUNT,char **,char *);
typedef DWORD (WINAPI *YAMN_CHECKFCN)(struct CheckParam *);
typedef DWORD (WINAPI *YAMN_DELETEFCN)(struct DeleteParam *);
-typedef WCHAR* (WINAPI *YAMN_GETERRORSTRINGWFCN)(DWORD);
+typedef TCHAR* (WINAPI *YAMN_GETERRORSTRINGWFCN)(DWORD);
typedef char* (WINAPI *YAMN_GETERRORSTRINGAFCN)(DWORD);
typedef void (WINAPI *YAMN_DELETEERRORSTRINGFCN)(LPVOID);
typedef DWORD (WINAPI *YAMN_WRITEACCOUNTSFCN)();
@@ -292,55 +292,34 @@ typedef struct CProtoPluginQueue //This deleting is full synchronized and safe. It is recommended for plugins to use this service.
//WPARAM- (HYAMNPLUGIN) Plugin handle
//LPARAM- (HACCOUNT) Account to delete
-#define MS_YAMN_DELETEACCOUNT "YAMN/Service/DeleteAccount"
+#define MS_YAMN_DELETEACCOUNT "YAMN/Service/DeleteAccount"
-//ReadAccountsA Service
+//ReadAccounts Service
//Reads standard accounts to file. Standard account means standard YAMN book format.
//WPARAM- (HYAMNPLUGIN) Plugin handle
-//LPARAM- (char *)filename string. Put here your own desired filename.
+//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_READACCOUNTSA "YAMN/Service/ReadAccountsA"
+#define MS_YAMN_READACCOUNTS "YAMN/Service/ReadAccounts"
-//ReadAccountsW Service
-//Same as ReadAccountsA service, but difference is in WPARAM
-//WPARAM- (HYAMNPLUGIN) Plugin handle
-//LPARAM- (WCHAR *)filename string. Use MS_YAMN_GETFILENAMEW service to retrieve your filename, or
-// just put your own desired filename
-#define MS_YAMN_READACCOUNTSW "YAMN/Service/ReadAccountsW"
-
-//WriteAccountsA Service
+//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- (char *)filename string. Put here your own desired filename.
-//return value is one of the ones written in "account.h" file
-#define MS_YAMN_WRITEACCOUNTSA "YAMN/Service/WriteAccountsA"
-
-//WriteAccountsW Service
-//Writes standard accounts to file. Standard account means standard YAMN book format.
-//WPARAM- (HYAMNPLUGIN) Plugin handle
-//LPARAM- (WCHAR *)filename string. Use MS_YAMN_GETFILENAMEW service to retrieve your filename, or
-// just put your own desired filename
+//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_WRITEACCOUNTSW "YAMN/Service/WriteAccountsW"
+#define MS_YAMN_WRITEACCOUNTS "YAMN/Service/WriteAccounts"
-//GetFileNameA Service
+//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- (char *) plugin string
-//LPARAM- any value
-//returns NULL when failed, otherwise returns (WCHAR *)string (!!! not char *) to filename!!!
+//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_GETFILENAMEA "YAMN/Service/GetFileNameA"
-
-//GetFileNameW Service
-//Same as GetFileNameA service, but difference is in WPARAM
-//WPARAM- (WCHAR *) plugin string
-//LPARAM- any value
-#define MS_YAMN_GETFILENAMEW "YAMN/Service/GetFileNameW"
+#define MS_YAMN_GETFILENAME "YAMN/Service/GetFileName"
//DeleteFileName Service
//deletes unicode string from memory
diff --git a/protocols/GTalkExt/inbox.cpp b/protocols/GTalkExt/inbox.cpp index 9317fbc6cf..dc556ddc6d 100644 --- a/protocols/GTalkExt/inbox.cpp +++ b/protocols/GTalkExt/inbox.cpp @@ -210,28 +210,28 @@ struct OPEN_URL_HEADER { HANDLE FindNetUserHandle(LPCSTR acc)
{
- IJabberInterface *ji = getJabberApi(acc);
- if (!ji) return NULL;
-
- PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h
-
- PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h
- sizeof(PVOID) + // skip vtable ptr
- sizeof(PVOID) + // skip m_ThreadInfo
- SIZE_OF_JABBER_OPTIONS); // skip m_options
-
- for (int i=0; i < 100; i++) {
- __try {
- if (GetNetlibHandleType(*pResult) == NLH_USER)
- break;
- }
- __except (EXCEPTION_EXECUTE_HANDLER){
- }
- pResult++;
- }
-
- assert(GetNetlibHandleType(*pResult) == NLH_USER);
- return *pResult;
+ IJabberInterface *ji = getJabberApi(acc);
+ if (!ji) return NULL;
+
+ PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h
+
+ PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h
+ sizeof(PVOID) + // skip vtable ptr
+ sizeof(PVOID) + // skip m_ThreadInfo
+ SIZE_OF_JABBER_OPTIONS); // skip m_options
+
+ for (int i=0; i < 100; i++) {
+ __try {
+ if (GetNetlibHandleType(*pResult) == NLH_USER)
+ break;
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER){
+ }
+ pResult++;
+ }
+
+ assert(GetNetlibHandleType(*pResult) == NLH_USER);
+ return *pResult;
}
unsigned __stdcall OpenUrlThread(OPEN_URL_HEADER* data)
@@ -395,8 +395,8 @@ void OpenContactInbox(HANDLE hContact) __finally {
free(url);
}
- }
- __finally {
- DBFreeVariant(&dbv);
- }
-}
\ No newline at end of file + }
+ __finally {
+ DBFreeVariant(&dbv);
+ }
+}
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 60b53aeaf4..02b7c43f23 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -54,11 +54,9 @@ static INT_PTR Proto_BroadcastAck(WPARAM wParam, LPARAM lParam) {
#ifdef _UNICODE
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack && ack->type == ACKTYPE_AVATAR && ack->hProcess)
- {
+ if (ack && ack->type == ACKTYPE_AVATAR && ack->hProcess) {
PROTO_AVATAR_INFORMATION* ai = (PROTO_AVATAR_INFORMATION*)ack->hProcess;
- if (ai->cbSize == sizeof(PROTO_AVATAR_INFORMATION))
- {
+ if (ai->cbSize == sizeof(PROTO_AVATAR_INFORMATION)) {
PROTO_AVATAR_INFORMATIONW aiw = { sizeof(aiw), ai->hContact, ai->format };
MultiByteToWideChar(CP_ACP, 0, ai->filename, -1, aiw.filename, SIZEOF(aiw.filename));
|