diff options
author | Nvinside <Nvinside@eced67a3-f377-a0ae-92ae-d6de1850b05a> | 2011-07-04 23:19:30 +0000 |
---|---|---|
committer | Nvinside <Nvinside@eced67a3-f377-a0ae-92ae-d6de1850b05a> | 2011-07-04 23:19:30 +0000 |
commit | 730ca7df52f2d5bec80da755eac0f140f6be5929 (patch) | |
tree | 30c8ccde244dff67f3b68f9930377c6e584817d3 /MirOTR | |
parent | 2e492f551d85eca9b6e55a91c9d7c9b6cee958c5 (diff) |
- small project cleanup
- typo fix
- context-sensitive langpacks support
git-svn-id: http://mirotr.googlecode.com/svn/trunk@58 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR')
-rw-r--r-- | MirOTR/MirOTR.vcxproj | 3 | ||||
-rw-r--r-- | MirOTR/MirOTR.vcxproj.filters | 3 | ||||
-rw-r--r-- | MirOTR/dllmain.cpp | 14 | ||||
-rw-r--r-- | MirOTR/language.h | 2 | ||||
-rw-r--r-- | MirOTR/mirotrmenu.cpp | 10 | ||||
-rw-r--r-- | MirOTR/mirotrmenu.h | 4 | ||||
-rw-r--r-- | MirOTR/options.cpp | 6 | ||||
-rw-r--r-- | MirOTR/stdafx.h | 13 | ||||
-rw-r--r-- | MirOTR/striphtml.cpp | 2 | ||||
-rw-r--r-- | MirOTR/targetver.h | 9 | ||||
-rw-r--r-- | MirOTR/utils.cpp | 204 |
11 files changed, 135 insertions, 135 deletions
diff --git a/MirOTR/MirOTR.vcxproj b/MirOTR/MirOTR.vcxproj index 819b1ca..d125e59 100644 --- a/MirOTR/MirOTR.vcxproj +++ b/MirOTR/MirOTR.vcxproj @@ -284,9 +284,6 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Unicode|x64'">true</ExcludedFromBuild>
</ResourceCompile>
</ItemGroup>
- <ItemGroup>
- <None Include="ReadMe.txt" />
- </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
diff --git a/MirOTR/MirOTR.vcxproj.filters b/MirOTR/MirOTR.vcxproj.filters index 06c80c8..81a5adf 100644 --- a/MirOTR/MirOTR.vcxproj.filters +++ b/MirOTR/MirOTR.vcxproj.filters @@ -122,7 +122,4 @@ <Filter>Ressourcendateien</Filter>
</ResourceCompile>
</ItemGroup>
- <ItemGroup>
- <None Include="ReadMe.txt" />
- </ItemGroup>
</Project>
\ No newline at end of file diff --git a/MirOTR/dllmain.cpp b/MirOTR/dllmain.cpp index c237d73..156ae3a 100644 --- a/MirOTR/dllmain.cpp +++ b/MirOTR/dllmain.cpp @@ -10,6 +10,7 @@ HINSTANCE hInst; PLUGINLINK *pluginLink;
MM_INTERFACE mmi;
UTF8_INTERFACE utfi;
+int hLangpack;
char* g_metaproto;
@@ -22,14 +23,14 @@ PLUGININFOEX pluginInfo={ AUTHOR_MAIL,
LEGAL_COPYRIGHT_LONG,
HOMEPAGE,
- UNICODE_AWARE, //not transient
- 0, //doesn't replace anything built-in
- MIID_OTRPLUGIN // ANSI and Unicode have different IDs
+ UNICODE_AWARE, // not transient
+ 0, // doesn't replace anything built-in
+ MIID_OTRPLUGIN // ANSI and Unicode have different IDs
};
BOOL APIENTRY DllMain( HMODULE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved
+ DWORD ul_reason_for_call,
+ LPVOID lpReserved
)
{
if (ul_reason_for_call == DLL_PROCESS_ATTACH) {
@@ -141,8 +142,11 @@ DLLFUNC int Load(PLUGINLINK *link) {
DEBUGOUT_T("LOAD MIROTR")
pluginLink=link;
+ mir_getLP( &pluginInfo );
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
+ /* for timezones
+ mir_getTMI(&tmi); */
CallService(MS_DB_SETSETTINGRESIDENT, TRUE, (LPARAM)(MODULENAME "/TrustLevel"));
diff --git a/MirOTR/language.h b/MirOTR/language.h index 499661b..8934405 100644 --- a/MirOTR/language.h +++ b/MirOTR/language.h @@ -46,7 +46,7 @@ #define LANG_OTR_NOTIFY LPGEN("OTR %s (%s)")
//#define LANG_FINGERPRINT_CAPTION LPGEN("OTR New Fingerprint")
-//#define LANG_FINGERPRINT_ASK_VERIFY LPGEN("OTR encrypted session with '%s'.\n\nFingerprint is UNVERIFIED.\n\n%s\n\nVerify?")
+//#define LANG_FINGERPRINT_ASK_VERIFY LPGEN("OTR encrypted session with '%s'.\n\nFingerprint is UNVERIFIED.\n\n%s\n\nVerify?")
//#define LANG_FINGERPRINT_ASK_NEW LPGEN("A new fingerprint has been recieved from '%s'\n\n%s\n\nDo you trust it?")
#define LANG_FINGERPRINT_VERIFIED LPGEN("OTR encrypted session with '%s' is now using a VERIFIED fingerprint")
#define LANG_FINGERPRINT_NOT_VERIFIED LPGEN("OTR encrypted session with '%s' is now using a NOT VERIFIED fingerprint")
diff --git a/MirOTR/mirotrmenu.cpp b/MirOTR/mirotrmenu.cpp index 005d8fb..03b7930 100644 --- a/MirOTR/mirotrmenu.cpp +++ b/MirOTR/mirotrmenu.cpp @@ -90,10 +90,10 @@ INT_PTR MirOTRMenuCheckService(WPARAM wParam,LPARAM) if ( cmep == NULL ) //this is rootsection...build it
return TRUE;
- HANDLE hContact = (HANDLE)pcpp->wParam, hSub;
- if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
- hContact = hSub;
- }
+ HANDLE hContact = (HANDLE)pcpp->wParam, hSub;
+ if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
+ hContact = hSub;
+ }
TrustLevel level = ( TrustLevel )otr_context_get_trust(otrl_context_find_miranda(otr_user_state, hContact));
@@ -168,7 +168,7 @@ INT_PTR OnAddMenuItemMirOTRMenu (WPARAM wParam, LPARAM lParam) LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
- {
+ {
case WM_MEASUREITEM:
if (CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam)) return TRUE;
break;
diff --git a/MirOTR/mirotrmenu.h b/MirOTR/mirotrmenu.h index fa24799..fe070f0 100644 --- a/MirOTR/mirotrmenu.h +++ b/MirOTR/mirotrmenu.h @@ -24,7 +24,7 @@ typedef struct {
int cbSize; //size in bytes of this structure
union {
- char* pszName; //[TRANSLATED-BY-CORE] text of the menu item
+ char* pszName; //[TRANSLATED-BY-CORE] text of the menu item
TCHAR* ptszName; //Unicode text of the menu item
};
int position; //approx position on the menu. lower numbers go nearer the top
@@ -32,7 +32,7 @@ typedef struct { DWORD flags; //set of MOMIF_* flags
union {
HICON hIcon; //icon to put by the item. If this was not loaded from
- //a resource, you can delete it straight after the call
+ //a resource, you can delete it straight after the call
HANDLE icolibItem; //set CMIF_ICONFROMICOLIB to pass this value
};
DWORD hotKey; //keyboard accelerator, same as lParam of WM_HOTKEY,0 for none
diff --git a/MirOTR/options.cpp b/MirOTR/options.cpp index 1e71f29..86781f1 100644 --- a/MirOTR/options.cpp +++ b/MirOTR/options.cpp @@ -6,7 +6,7 @@ #include <commctrl.h>
#include <process.h>
-char g_fingerprint_store_filename[MAX_PATH]; +char g_fingerprint_store_filename[MAX_PATH];
char g_private_key_filename[MAX_PATH];
HANDLE hPATH_MIROTR;
Options options;
@@ -783,7 +783,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w fp = context->fingerprint_root.next;
while(fp) {
otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
- if (hash) { + if (hash) {
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)fp;
lvI.pszText = user;
@@ -794,7 +794,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w ListView_SetItemText(lv,d, 3, (fp->trust && fp->trust != '\0')? TranslateT(LANG_YES) : TranslateT(LANG_NO));
ListView_SetItemText(lv,d, 4, hash );
}
- fp = fp->next; + fp = fp->next;
}
mir_free(proto);
}
diff --git a/MirOTR/stdafx.h b/MirOTR/stdafx.h index 49f7da1..f4ad6e2 100644 --- a/MirOTR/stdafx.h +++ b/MirOTR/stdafx.h @@ -8,6 +8,7 @@ #include "targetver.h"
#define WIN32_LEAN_AND_MEAN // Selten verwendete Teile der Windows-Header nicht einbinden.
+
// Windows-Headerdateien:
#include <windows.h>
#include <string.h>
@@ -23,25 +24,29 @@ #define DEBUGOUT_T(x)
#endif
#define MIRANDA_VER 0x0800
-
+#define MIRANDA_CUSTOM_LP
+
+//include
#include <newpluginapi.h>
#include <m_system.h>
#include <m_langpack.h>
#include <m_utils.h>
#include <m_database.h>
-#include <m_folders.h>
#include <m_clist.h>
#include <m_message.h>
-#include <m_metacontacts.h>
#include <m_protocols.h>
#include <m_protomod.h>
#include <m_protosvc.h>
-#include <m_updater.h>
#include <m_popup.h>
#include <m_contacts.h>
#include <m_utils.h>
#include <m_icolib.h>
+
+//ExternalAPI
+#include <m_folders.h>
+#include <m_updater.h>
#include <m_msg_buttonsbar.h>
+#include <m_metacontacts.h>
#include <gcrypt.h>
extern "C" {
diff --git a/MirOTR/striphtml.cpp b/MirOTR/striphtml.cpp index 31eceef..c76b0f7 100644 --- a/MirOTR/striphtml.cpp +++ b/MirOTR/striphtml.cpp @@ -78,7 +78,7 @@ void endtag_cb (void *cbdata, ekhtml_string_t *tag) { void data_cb (void *cbdata, ekhtml_string_t *text) {
STRIPHTML_DATA *data = (STRIPHTML_DATA *)cbdata;
if(text->len <= 0)
- return;
+ return;
char* s = (char*) mir_calloc(text->len+1);
decode_html_entities_utf8(s, text->str, text->len);
diff --git a/MirOTR/targetver.h b/MirOTR/targetver.h index c448111..4b435d6 100644 --- a/MirOTR/targetver.h +++ b/MirOTR/targetver.h @@ -7,7 +7,8 @@ // Ändern Sie folgende Definitionen für Plattformen, die älter als die unten angegebenen sind.
// Unter MSDN finden Sie die neuesten Informationen über die entsprechenden Werte für die unterschiedlichen Plattformen.
-#ifndef WINVER // Gibt an, dass Windows 2000 die mindestens erforderliche Plattform ist.
+
+#ifndef WINVER // Gibt an, dass Windows 2000 die mindestens erforderliche Plattform ist.
#define WINVER 0x0500 // Ändern Sie den entsprechenden Wert, um auf andere Versionen von Windows abzuzielen.
#endif
@@ -15,10 +16,6 @@ #define _WIN32_WINNT 0x0500 // Ändern Sie den entsprechenden Wert, um auf andere Versionen von Windows abzuzielen.
#endif
-#ifndef _WIN32_WINDOWS // Gibt an, dass Windows 98 die mindestens erforderliche Plattform ist.
-#define _WIN32_WINDOWS 0x0410 // Ändern Sie den entsprechenden Wert, um auf mindestens Windows Me abzuzielen.
-#endif
-
-#ifndef _WIN32_IE // Gibt an, dass Internet Explorer 7.0 die mindestens erforderliche Plattform ist.
+#ifndef _WIN32_IE // Gibt an, dass Internet Explorer 7.0 die mindestens erforderliche Plattform ist.
#define _WIN32_IE 0x0700 // Ändern Sie den entsprechenden Wert, um auf andere Versionen von IE abzuzielen.
#endif
diff --git a/MirOTR/utils.cpp b/MirOTR/utils.cpp index 6fe6dde..3d3a505 100644 --- a/MirOTR/utils.cpp +++ b/MirOTR/utils.cpp @@ -1,24 +1,24 @@ -#include "stdafx.h" -#include "utils.h" - -CRITICAL_SECTION lib_cs; - -void InitUtils() { - InitializeCriticalSection(&lib_cs); -} -void DeinitUtils() { - DeleteCriticalSection(&lib_cs); -} - +#include "stdafx.h"
+#include "utils.h"
+
+CRITICAL_SECTION lib_cs;
+
+void InitUtils() {
+ InitializeCriticalSection(&lib_cs);
+}
+void DeinitUtils() {
+ DeleteCriticalSection(&lib_cs);
+}
+
void lib_cs_lock() {
EnterCriticalSection(&lib_cs);
}
void lib_cs_unlock() {
LeaveCriticalSection(&lib_cs);
-} - -HANDLE find_contact(const char* userid, const char* protocol) { +}
+
+HANDLE find_contact(const char* userid, const char* protocol) {
HANDLE hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDFIRST, 0, 0 );
while ( hContact != NULL )
{
@@ -34,79 +34,79 @@ HANDLE find_contact(const char* userid, const char* protocol) { hContact = ( HANDLE )CallService( MS_DB_CONTACT_FINDNEXT,( WPARAM )hContact, 0 );
}
- return 0; -} - -/* Look up a connection context by hContact from the given -* OtrlUserState. If add_if_missing is true, allocate and return a new -* context if one does not currently exist. In that event, call -* add_app_data(data, context) so that app_data and app_data_free can be -* filled in by the application, and set *addedp to 1. */ -ConnContext * otrl_context_find_miranda(OtrlUserState us, HANDLE hContact) -{ - ConnContext ** curp; - if (!hContact) return NULL; - for (curp = &(us->context_root); *curp; curp = &((*curp)->next)) { - if ((*curp)->app_data == hContact ) return *curp; - } - return NULL; -} - -/* What level of trust do we have in the privacy of this ConnContext? */ -TrustLevel otr_context_get_trust(ConnContext *context) -{ - TrustLevel level = TRUST_NOT_PRIVATE; - - if (context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) { - if (context->active_fingerprint->trust && - context->active_fingerprint->trust[0] != '\0') { - level = TRUST_PRIVATE; - } else { - level = TRUST_UNVERIFIED; - } - } else if (context && context->msgstate == OTRL_MSGSTATE_FINISHED) { - level = TRUST_FINISHED; - } - - return level; -} - -/* Set verification of fingerprint */ + return 0;
+}
+
+/* Look up a connection context by hContact from the given
+* OtrlUserState. If add_if_missing is true, allocate and return a new
+* context if one does not currently exist. In that event, call
+* add_app_data(data, context) so that app_data and app_data_free can be
+* filled in by the application, and set *addedp to 1. */
+ConnContext * otrl_context_find_miranda(OtrlUserState us, HANDLE hContact)
+{
+ ConnContext ** curp;
+ if (!hContact) return NULL;
+ for (curp = &(us->context_root); *curp; curp = &((*curp)->next)) {
+ if ((*curp)->app_data == hContact ) return *curp;
+ }
+ return NULL;
+}
+
+/* What level of trust do we have in the privacy of this ConnContext? */
+TrustLevel otr_context_get_trust(ConnContext *context)
+{
+ TrustLevel level = TRUST_NOT_PRIVATE;
+
+ if (context && context->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
+ if (context->active_fingerprint->trust &&
+ context->active_fingerprint->trust[0] != '\0') {
+ level = TRUST_PRIVATE;
+ } else {
+ level = TRUST_UNVERIFIED;
+ }
+ } else if (context && context->msgstate == OTRL_MSGSTATE_FINISHED) {
+ level = TRUST_FINISHED;
+ }
+
+ return level;
+}
+
+/* Set verification of fingerprint */
void VerifyFingerprint(ConnContext *context, bool verify) {
lib_cs_lock();
otrl_context_set_trust(context->active_fingerprint, (verify)?"verified":NULL);
otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
lib_cs_unlock();
VerifyFingerprintMessage(context, verify);
-} - -void VerifyFingerprintMessage(ConnContext *context, bool verify) { - TCHAR msg[1024]; +}
+
+void VerifyFingerprintMessage(ConnContext *context, bool verify) {
+ TCHAR msg[1024];
mir_sntprintf(msg, 1024, (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HANDLE)context->app_data));
msg[1023] = '\0';
ShowMessage((HANDLE)context->app_data, msg);
- SetEncryptionStatus(context->app_data, otr_context_get_trust(context)); -} - -/* Convert a 20-byte hash value to a 45-byte human-readable value */ -void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20]) -{ - int word, byte; - TCHAR *p = human; - - for(word=0; word<5; ++word) { - for(byte=0; byte<4; ++byte) { - _stprintf(p, _T("%02X"), hash[word*4+byte]); - p += 2; - } - *(p++) = ' '; - } - /* Change that last ' ' to a '\0' */ - --p; - *p = '\0'; -} - -char* contact_get_id(HANDLE hContact, bool bNameOnError) { + SetEncryptionStatus(context->app_data, otr_context_get_trust(context));
+}
+
+/* Convert a 20-byte hash value to a 45-byte human-readable value */
+void otrl_privkey_hash_to_humanT(TCHAR human[45], const unsigned char hash[20])
+{
+ int word, byte;
+ TCHAR *p = human;
+
+ for(word=0; word<5; ++word) {
+ for(byte=0; byte<4; ++byte) {
+ _stprintf(p, _T("%02X"), hash[word*4+byte]);
+ p += 2;
+ }
+ *(p++) = ' ';
+ }
+ /* Change that last ' ' to a '\0' */
+ --p;
+ *p = '\0';
+}
+
+char* contact_get_id(HANDLE hContact, bool bNameOnError) {
char* pszUniqueID = NULL;
CONTACTINFO ci;
ZeroMemory(&ci, sizeof(ci));
@@ -131,29 +131,29 @@ char* contact_get_id(HANDLE hContact, bool bNameOnError) { if (pszUniqueID)
mir_snprintf(pszUniqueID, 15, ("%u"), ci.bVal);
}
- } - if (!pszUniqueID && bNameOnError) { - char *name = (char *)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, 0 ); - if (name) pszUniqueID = mir_strdup(name); - } - return pszUniqueID; -} - -__inline const TCHAR* contact_get_nameT(HANDLE hContact) { - return (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, GCDNF_TCHAR ); -} - -__inline const char* contact_get_proto(HANDLE hContact) { - char *uproto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - return uproto; -} - -__inline const char* contact_get_account(HANDLE hContact) { - char *uacc = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0); - return uacc; -} - -void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE hContact) { + }
+ if (!pszUniqueID && bNameOnError) {
+ char *name = (char *)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, 0 );
+ if (name) pszUniqueID = mir_strdup(name);
+ }
+ return pszUniqueID;
+}
+
+__inline const TCHAR* contact_get_nameT(HANDLE hContact) {
+ return (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, GCDNF_TCHAR );
+}
+
+__inline const char* contact_get_proto(HANDLE hContact) {
+ char *uproto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ return uproto;
+}
+
+__inline const char* contact_get_account(HANDLE hContact) {
+ char *uacc = (char *)CallService(MS_PROTO_GETCONTACTBASEACCOUNT, (WPARAM)hContact, 0);
+ return uacc;
+}
+
+void ShowPopup(const TCHAR* line1, const TCHAR* line2, int timeout, const HANDLE hContact) {
if(CallService(MS_SYSTEM_TERMINATED, 0, 0)) return;
if ( !options.bHavePopups) {
|