summaryrefslogtreecommitdiff
path: root/protocols/Twitter/src/connection.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2012-10-16 18:41:01 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2012-10-16 18:41:01 +0000
commit36b11989c21feab57daa31846533d1cb6725515b (patch)
tree7580dbdc19501bc62b54124819899f1553103835 /protocols/Twitter/src/connection.cpp
parent12386d7fcb66097eb00926796f0cbcfeda450566 (diff)
Updated Twitter to version 1.0.0.2:
Revision: 16 Autor: seventh.adept Datum: Dienstag, 16. Oktober 2012 15:33:18 Meldung: forgot to bump the version in version.h to 1.0.0.2 Revision: 15 Autor: seventh.adept Datum: Dienstag, 16. Oktober 2012 15:03:41 Meldung: - Updated plugin to work with API v1.1 - Made an attempt to fix truncated retweets. My work around isn't pretty and can fail, if anyone wants to help give me a yell - added comments Revision: 14 Autor: seventh.adept Datum: Donnerstag, 7. Juni 2012 15:38:40 Meldung: fixed the "&amp;" issue in tweets version bump 1.0.0.1 git-svn-id: http://svn.miranda-ng.org/main/trunk@1960 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Twitter/src/connection.cpp')
-rw-r--r--protocols/Twitter/src/connection.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index 488bd3e657..b7bfadfdf0 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -134,6 +134,10 @@ bool TwitterProto::NegotiateConnection()
DBFreeVariant(&dbv);
}
+ // twitter changed the base URL in v1.1 of the API, I don't think users will need to modify it, so
+ // i'll be forcing it to the new API URL here. After a while I can get rid of this as users will
+ // have either had this run at least once, or have reset their miranda profile. 14/10/2012
+ DBWriteContactSettingString(0,m_szModuleName,TWITTER_KEY_BASEURL,"https://api.twitter.com/1.1/");
if((oauthToken.size() <= 1) || (oauthTokenSecret.size() <= 1)) {
// first, reset all the keys so we can start fresh
@@ -419,6 +423,7 @@ struct update_avatar
std::string url;
};
+/* void *p should always be a struct of type update_avatar */
void TwitterProto::UpdateAvatarWorker(void *p)
{
if(p == 0)
@@ -426,11 +431,14 @@ void TwitterProto::UpdateAvatarWorker(void *p)
std::auto_ptr<update_avatar> data( static_cast<update_avatar*>(p));
DBVARIANT dbv;
+ // DBGetContactSettingString returns 0 when it suceeds, so if this suceeds it will return 0, or false.
+ // therefore if it returns 1, or true, we want to return as there is no such user.
+ // as a side effect, dbv now has the username in it i think
if(DBGetContactSettingTString(data->hContact,m_szModuleName,TWITTER_KEY_UN,&dbv))
return;
- std::string ext = data->url.substr(data->url.rfind('.'));
- std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str());
+ std::string ext = data->url.substr(data->url.rfind('.')); // finds the filetype of the avatar
+ std::tstring filename = GetAvatarFolder() + _T('\\') + dbv.ptszVal + (TCHAR*)_A2T(ext.c_str()); // local filename and path
DBFreeVariant(&dbv);
PROTO_AVATAR_INFORMATIONT ai = {sizeof(ai)};
@@ -442,11 +450,11 @@ void TwitterProto::UpdateAvatarWorker(void *p)
return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this.
}
- _tcsncpy(ai.filename,filename.c_str(),MAX_PATH);
+ _tcsncpy(ai.filename,filename.c_str(),MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
LOG( _T("***** Updating avatar: %s"), data->url.c_str());
WaitForSingleObjectEx(avatar_lock_,INFINITE,true);
- if(CallService(MS_SYSTEM_TERMINATED,0,0))
+ if(CallService(MS_SYSTEM_TERMINATED,0,0)) // if miranda is shutting down...
{
LOG( _T("***** Terminating avatar update early: %s"),data->url.c_str());
return;