summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-06 21:04:14 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-06 21:04:14 +0000
commit180aaabf99e2ae20f7b2f8e370490b9ee7244ca7 (patch)
treeda446ea98d83017b0aee5421651230693f2f283a
parent4b9b01c4e23576dc423d36a39ece3adc69e0b1ae (diff)
compilation fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@343 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Twitter/contacts.cpp33
-rw-r--r--protocols/Twitter/main.cpp2
-rw-r--r--protocols/Twitter/proto.cpp4
-rw-r--r--protocols/Twitter/proto.h22
-rw-r--r--protocols/Twitter/stubs.cpp19
-rw-r--r--protocols/Twitter/twitter.h6
-rw-r--r--protocols/Twitter/twitter.vcxproj1
-rw-r--r--protocols/Twitter/twitter.vcxproj.filters3
8 files changed, 53 insertions, 37 deletions
diff --git a/protocols/Twitter/contacts.cpp b/protocols/Twitter/contacts.cpp
index 9ab2f65905..6478ac09db 100644
--- a/protocols/Twitter/contacts.cpp
+++ b/protocols/Twitter/contacts.cpp
@@ -23,6 +23,7 @@ void TwitterProto::AddToListWorker(void *p)
// TODO: what happens if there is an error?
if(p == 0)
return;
+
char *name = static_cast<char*>(p);
try
@@ -48,8 +49,8 @@ HANDLE TwitterProto::AddToList(int flags,PROTOSEARCHRESULT *result)
if(m_iStatus != ID_STATUS_ONLINE)
return 0;
- ForkThread(&TwitterProto::AddToListWorker,this,mir_strdup(result->nick));
- return AddToClientList(result->nick,"");
+ ForkThread(&TwitterProto::AddToListWorker,this,mir_utf8encodeT(result->nick));
+ return AddToClientList( _T2A(result->nick),"");
}
// *************************
@@ -98,9 +99,9 @@ int TwitterProto::GetInfo(HANDLE hContact,int info_type)
struct search_query
{
- search_query(const std::string &query,bool by_email) : query(query),by_email(by_email)
+ search_query(const std::tstring &_query,bool _by_email) : query(_query),by_email(_by_email)
{}
- std::string query;
+ std::tstring query;
bool by_email;
};
@@ -116,11 +117,14 @@ void TwitterProto::DoSearch(void *p)
bool found;
try
{
+ char* p = mir_utf8encodeT( query->query.c_str());
+
ScopedLock s(twitter_lock_);
if(query->by_email)
- found = twit_.get_info_by_email(query->query,&info);
+ found = twit_.get_info_by_email(p,&info);
else
- found = twit_.get_info(query->query,&info);
+ found = twit_.get_info(p,&info);
+ mir_free( p );
}
catch(const std::exception &e)
{
@@ -129,14 +133,15 @@ void TwitterProto::DoSearch(void *p)
LOG("***** Error searching for contacts: %s",e.what());
}
- if(found)
- {
- psr.nick = const_cast<char*>( info.username. c_str() );
- psr.firstName = const_cast<char*>( info.real_name.c_str() );
+ if(found) {
+ psr.nick = mir_a2t( info.username. c_str());
+ psr.firstName = mir_a2t( info.real_name.c_str());
- ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_DATA,(HANDLE)1,
- (LPARAM)&psr);
+ ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_DATA,(HANDLE)1, (LPARAM)&psr);
ProtoBroadcastAck(m_szModuleName,0,ACKTYPE_SEARCH,ACKRESULT_SUCCESS,(HANDLE)1,0);
+
+ mir_free(psr.nick);
+ mir_free(psr.firstName);
}
else
{
@@ -146,13 +151,13 @@ void TwitterProto::DoSearch(void *p)
delete query;
}
-HANDLE TwitterProto::SearchBasic(const char *username)
+HANDLE TwitterProto::SearchBasic(const TCHAR *username)
{
ForkThread(&TwitterProto::DoSearch,this,new search_query(username,false));
return (HANDLE)1;
}
-HANDLE TwitterProto::SearchByEmail(const char *email)
+HANDLE TwitterProto::SearchByEmail(const TCHAR *email)
{
ForkThread(&TwitterProto::DoSearch,this,new search_query(email,true));
return (HANDLE)1;
diff --git a/protocols/Twitter/main.cpp b/protocols/Twitter/main.cpp
index a8a188891f..53e80b8bb5 100644
--- a/protocols/Twitter/main.cpp
+++ b/protocols/Twitter/main.cpp
@@ -33,6 +33,7 @@ int hLangpack;
CLIST_INTERFACE* pcli;
HINSTANCE g_hInstance;
+int hLangpack = 0;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -51,6 +52,7 @@ PLUGININFOEX pluginInfo={
/////////////////////////////////////////////////////////////////////////////
// Protocol instances
+
static int compare_protos(const TwitterProto *p1, const TwitterProto *p2)
{
return _tcscmp(p1->m_tszUserName, p2->m_tszUserName);
diff --git a/protocols/Twitter/proto.cpp b/protocols/Twitter/proto.cpp
index a65ddf978b..530017c491 100644
--- a/protocols/Twitter/proto.cpp
+++ b/protocols/Twitter/proto.cpp
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utility.h"
#include "theme.h"
#include "ui.h"
+#include "oauth.dev.h"
#include "m_folders.h"
#include "m_historyevents.h"
@@ -35,8 +36,7 @@ TwitterProto::TwitterProto(const char *proto_name,const TCHAR *username)
m_szModuleName = mir_strdup (proto_name);
m_tszUserName = mir_tstrdup(username);
- CreateProtoService(m_szModuleName,PS_CREATEACCMGRUI,
- &TwitterProto::SvcCreateAccMgrUI,this);
+ CreateProtoService(m_szModuleName,PS_CREATEACCMGRUI, &TwitterProto::SvcCreateAccMgrUI,this);
CreateProtoService(m_szModuleName,PS_GETNAME, &TwitterProto::GetName, this);
CreateProtoService(m_szModuleName,PS_GETSTATUS,&TwitterProto::GetStatus, this);
diff --git a/protocols/Twitter/proto.h b/protocols/Twitter/proto.h
index e7353b5dfe..d4f60536f8 100644
--- a/protocols/Twitter/proto.h
+++ b/protocols/Twitter/proto.h
@@ -51,34 +51,34 @@ public:
virtual HANDLE __cdecl AddToListByEvent(int,int,HANDLE);
virtual int __cdecl Authorize(HANDLE);
- virtual int __cdecl AuthDeny(HANDLE,const char *);
+ virtual int __cdecl AuthDeny(HANDLE,const TCHAR *);
virtual int __cdecl AuthRecv(HANDLE,PROTORECVEVENT *);
- virtual int __cdecl AuthRequest(HANDLE,const char *);
+ virtual int __cdecl AuthRequest(HANDLE,const TCHAR *);
virtual HANDLE __cdecl ChangeInfo(int,void *);
- virtual HANDLE __cdecl FileAllow(HANDLE,HANDLE,const char *);
+ virtual HANDLE __cdecl FileAllow(HANDLE,HANDLE,const TCHAR *);
virtual int __cdecl FileCancel(HANDLE,HANDLE);
- virtual int __cdecl FileDeny(HANDLE,HANDLE,const char *);
- virtual int __cdecl FileResume(HANDLE,int *,const char **);
+ virtual int __cdecl FileDeny(HANDLE,HANDLE,const TCHAR *);
+ virtual int __cdecl FileResume(HANDLE,int *,const TCHAR **);
virtual DWORD __cdecl GetCaps(int,HANDLE = 0);
virtual HICON __cdecl GetIcon(int);
virtual int __cdecl GetInfo(HANDLE,int);
- virtual HANDLE __cdecl SearchBasic(const char *);
- virtual HANDLE __cdecl SearchByEmail(const char *);
- virtual HANDLE __cdecl SearchByName(const char *,const char *,const char *);
+ virtual HANDLE __cdecl SearchBasic(const TCHAR *);
+ virtual HANDLE __cdecl SearchByEmail(const TCHAR *);
+ virtual HANDLE __cdecl SearchByName(const TCHAR *,const TCHAR *,const TCHAR *);
virtual HWND __cdecl SearchAdvanced(HWND);
virtual HWND __cdecl CreateExtendedSearchUI(HWND);
virtual int __cdecl RecvContacts(HANDLE,PROTORECVEVENT *);
- virtual int __cdecl RecvFile(HANDLE,PROTORECVFILE *);
+ virtual int __cdecl RecvFile(HANDLE,PROTORECVFILET *);
virtual int __cdecl RecvMsg(HANDLE,PROTORECVEVENT *);
virtual int __cdecl RecvUrl(HANDLE,PROTORECVEVENT *);
virtual int __cdecl SendContacts(HANDLE,int,int,HANDLE *);
- virtual HANDLE __cdecl SendFile(HANDLE,const char *,char **);
+ virtual HANDLE __cdecl SendFile(HANDLE,const TCHAR *,TCHAR **);
virtual int __cdecl SendMsg(HANDLE,int,const char *);
virtual int __cdecl SendUrl(HANDLE,int,const char *);
@@ -88,7 +88,7 @@ public:
virtual HANDLE __cdecl GetAwayMsg(HANDLE);
virtual int __cdecl RecvAwayMsg(HANDLE,int,PROTORECVEVENT *);
virtual int __cdecl SendAwayMsg(HANDLE,HANDLE,const char *);
- virtual int __cdecl SetAwayMsg(int,const char *);
+ virtual int __cdecl SetAwayMsg(int,const TCHAR *);
virtual int __cdecl UserIsTyping(HANDLE,int);
diff --git a/protocols/Twitter/stubs.cpp b/protocols/Twitter/stubs.cpp
index 79ee2e7c9d..1bf2dcbdd0 100644
--- a/protocols/Twitter/stubs.cpp
+++ b/protocols/Twitter/stubs.cpp
@@ -27,7 +27,7 @@ int TwitterProto::Authorize(HANDLE hContact)
return 0;
}
-int TwitterProto::AuthDeny(HANDLE hContact,const char *reason)
+int TwitterProto::AuthDeny(HANDLE hContact,const TCHAR *reason)
{
return 0;
}
@@ -37,7 +37,7 @@ int TwitterProto::AuthRecv(HANDLE hContact,PROTORECVEVENT *)
return 0;
}
-int TwitterProto::AuthRequest(HANDLE hContact,const char *message)
+int TwitterProto::AuthRequest(HANDLE hContact,const TCHAR *message)
{
return 0;
}
@@ -48,7 +48,7 @@ HANDLE TwitterProto::ChangeInfo(int type,void *info_data)
return 0;
}
-HANDLE TwitterProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const char *path)
+HANDLE TwitterProto::FileAllow(HANDLE hContact,HANDLE hTransfer,const TCHAR *path)
{
return 0;
}
@@ -58,18 +58,17 @@ int TwitterProto::FileCancel(HANDLE hContact,HANDLE hTransfer)
return 0;
}
-int TwitterProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const char *reason)
+int TwitterProto::FileDeny(HANDLE hContact,HANDLE hTransfer,const TCHAR *reason)
{
return 0;
}
-int TwitterProto::FileResume(HANDLE hTransfer,int *action,const char **filename)
+int TwitterProto::FileResume(HANDLE hTransfer,int *action,const TCHAR **filename)
{
return 0;
}
-HANDLE TwitterProto::SearchByName(const char *nick,const char *first_name,
- const char *last_name)
+HANDLE TwitterProto::SearchByName(const TCHAR *nick,const TCHAR *first_name, const TCHAR *last_name)
{
return 0;
}
@@ -89,7 +88,7 @@ int TwitterProto::RecvContacts(HANDLE hContact,PROTORECVEVENT *)
return 0;
}
-int TwitterProto::RecvFile(HANDLE hContact,PROTORECVFILE *)
+int TwitterProto::RecvFile(HANDLE hContact,PROTORECVFILET *)
{
return 0;
}
@@ -104,7 +103,7 @@ int TwitterProto::SendContacts(HANDLE hContact,int flags,int nContacts,HANDLE *h
return 0;
}
-HANDLE TwitterProto::SendFile(HANDLE hContact,const char *desc, char **files)
+HANDLE TwitterProto::SendFile(HANDLE hContact,const TCHAR *desc, TCHAR **files)
{
return 0;
}
@@ -129,7 +128,7 @@ int TwitterProto::SendAwayMsg(HANDLE hContact,HANDLE hProcess,const char *msg)
return 0;
}
-int TwitterProto::SetAwayMsg(int status,const char *msg)
+int TwitterProto::SetAwayMsg(int status,const TCHAR *msg)
{
return 0;
}
diff --git a/protocols/Twitter/twitter.h b/protocols/Twitter/twitter.h
index 56d8914117..d26c06bdbd 100644
--- a/protocols/Twitter/twitter.h
+++ b/protocols/Twitter/twitter.h
@@ -30,6 +30,12 @@ using std::vector;
#include "StringConv.h"
#include "stdafx.h"
+#if defined( _UNICODE )
+ #define tstring wstring
+#else
+ #define tstring string
+#endif
+
typedef unsigned long long twitter_id;
typedef std::map<std::wstring, std::wstring> OAuthParameters;
diff --git a/protocols/Twitter/twitter.vcxproj b/protocols/Twitter/twitter.vcxproj
index 7be07ed059..08afdaffb6 100644
--- a/protocols/Twitter/twitter.vcxproj
+++ b/protocols/Twitter/twitter.vcxproj
@@ -177,6 +177,7 @@
<ClCompile Include="chat.cpp" />
<ClCompile Include="connection.cpp" />
<ClCompile Include="contacts.cpp" />
+ <ClCompile Include="Debug.c" />
<ClCompile Include="http.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="oauth.cpp" />
diff --git a/protocols/Twitter/twitter.vcxproj.filters b/protocols/Twitter/twitter.vcxproj.filters
index 020644005c..71adbd234a 100644
--- a/protocols/Twitter/twitter.vcxproj.filters
+++ b/protocols/Twitter/twitter.vcxproj.filters
@@ -60,6 +60,9 @@
<ClCompile Include="oauth.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="Debug.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="common.h">