summaryrefslogtreecommitdiff
path: root/protocols/Twitter
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-10-27 09:04:24 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-10-27 09:04:24 +0000
commit3493aade67d1b80576777bddb8450a09987b1582 (patch)
treed13bb42fc867e37b1a4d5ddb1ed76310773186f3 /protocols/Twitter
parent22aa69a8d572fa38305471698da4340b93aa4290 (diff)
Twitter version bump to 1.0.0.3, version standardization, description update in russian langpack
git-svn-id: http://svn.miranda-ng.org/main/trunk@2090 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Twitter')
-rw-r--r--protocols/Twitter/res/twitter.rc37
-rw-r--r--protocols/Twitter/res/version.rc38
-rw-r--r--protocols/Twitter/src/connection.cpp8
-rw-r--r--protocols/Twitter/src/main.cpp14
-rw-r--r--protocols/Twitter/src/twitter.cpp37
-rw-r--r--protocols/Twitter/src/ui.cpp2
-rw-r--r--protocols/Twitter/src/version.h34
-rw-r--r--protocols/Twitter/twitter.vcxproj1
-rw-r--r--protocols/Twitter/twitter.vcxproj.filters3
9 files changed, 96 insertions, 78 deletions
diff --git a/protocols/Twitter/res/twitter.rc b/protocols/Twitter/res/twitter.rc
index 9c8104c65b..6b6e88fc56 100644
--- a/protocols/Twitter/res/twitter.rc
+++ b/protocols/Twitter/res/twitter.rc
@@ -191,43 +191,6 @@ END
#endif // APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,2
- PRODUCTVERSION 1,0,0,2
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "FileDescription", "Twitter protocol plugin for Miranda NG"
- VALUE "FileVersion", "1.0.0.2"
- VALUE "InternalName", "twitter"
- VALUE "LegalCopyright", "Copyright © 2009-2012"
- VALUE "OriginalFilename", "twitter.dll"
- VALUE "ProductName", "Miranda-Twitter"
- VALUE "ProductVersion", "1.0.0.2"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/Twitter/res/version.rc b/protocols/Twitter/res/version.rc
new file mode 100644
index 0000000000..5bfbab4754
--- /dev/null
+++ b/protocols/Twitter/res/version.rc
@@ -0,0 +1,38 @@
+// Microsoft Visual C++ generated resource script.
+//
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+#include "afxres.h"
+#include "..\src\version.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __FILEVERSION_STRING
+ PRODUCTVERSION __FILEVERSION_STRING
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "000004b0"
+ BEGIN
+ VALUE "FileDescription", __DESCRIPTION
+ VALUE "InternalName", __PLUGIN_NAME
+ VALUE "LegalCopyright", __COPYRIGHT
+ VALUE "OriginalFilename", __FILENAME
+ VALUE "ProductName", __PLUGIN_NAME
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0, 1200
+ END
+END
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp
index b7bfadfdf0..d7d6ba9b16 100644
--- a/protocols/Twitter/src/connection.cpp
+++ b/protocols/Twitter/src/connection.cpp
@@ -137,7 +137,7 @@ bool TwitterProto::NegotiateConnection()
// 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/");
+ //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
@@ -381,7 +381,7 @@ void TwitterProto::MessageLoop(void*)
if(m_iStatus != ID_STATUS_ONLINE)
goto exit;
- if(i%4 == 0)
+ if(i%10 == 0)
UpdateFriends();
if(m_iStatus != ID_STATUS_ONLINE)
@@ -390,7 +390,9 @@ void TwitterProto::MessageLoop(void*)
if(m_iStatus != ID_STATUS_ONLINE)
goto exit;
- UpdateMessages(new_account);
+
+ if(i%10 == 0)
+ UpdateMessages(new_account);
if(new_account) // Not anymore!
{
diff --git a/protocols/Twitter/src/main.cpp b/protocols/Twitter/src/main.cpp
index e354725dce..c92e757597 100644
--- a/protocols/Twitter/src/main.cpp
+++ b/protocols/Twitter/src/main.cpp
@@ -29,13 +29,13 @@ int hLangpack = 0;
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
- "Twitter Plugin",
- __VERSION_DWORD,
- "Provides basic support for Twitter protocol.",
- "dentist, omniwolf, Thief",
- "",
- "© 2009-2010 dentist, 2010-2012 omniwolf and Thief",
- "http://miranda-ng.org/",
+ __PLUGIN_NAME,
+ PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
+ __DESCRIPTION,
+ __AUTHOR,
+ __AUTHOREMAIL,
+ __COPYRIGHT,
+ __AUTHORWEB,
UNICODE_AWARE,
//{BC09A71B-B86E-4d33-B18D-82D30451DD3C}
{ 0xbc09a71b, 0xb86e, 0x4d33, { 0xb1, 0x8d, 0x82, 0xd3, 0x4, 0x51, 0xdd, 0x3c } }
diff --git a/protocols/Twitter/src/twitter.cpp b/protocols/Twitter/src/twitter.cpp
index 6371e68ca7..f5c3d1a8b3 100644
--- a/protocols/Twitter/src/twitter.cpp
+++ b/protocols/Twitter/src/twitter.cpp
@@ -78,7 +78,7 @@ static T retrieve(const js::object &o,const std::string &key,bool allow_null = f
-twitter::twitter() : base_url_("https://api.twitter.com/1.1/")
+twitter::twitter() : base_url_("https://api.twitter.com/")
{}
bool twitter::set_credentials(const std::string &username, const std::wstring &consumerKey, const std::wstring &consumerSecret,
@@ -92,7 +92,7 @@ bool twitter::set_credentials(const std::string &username, const std::wstring &c
pin_ = pin;
if(test)
- return slurp(base_url_+"account/verify_credentials.json",http::get).code == 200;
+ return slurp(base_url_+"1.1/account/verify_credentials.json",http::get).code == 200;
else
return true;
}
@@ -168,7 +168,7 @@ std::vector<twitter_user> twitter::get_friends()
//js::array friendArray = buildFriendList();
std::vector<twitter_user> friends;
- http::response resp = slurp(base_url_+"statuses/friends.json",http::get);
+ http::response resp = slurp(base_url_+"1.1/statuses/friends.json",http::get);
if(resp.code != 200)
throw bad_response();
@@ -212,7 +212,7 @@ bool twitter::get_info(const std::string &name,twitter_user *info)
if(!info)
return false;
- std::string url = base_url_+"users/show/"+http::url_encode(name)+".json";
+ std::string url = base_url_+"1.1/users/show/"+http::url_encode(name)+".json";
http::response resp = slurp(url,http::get);
if(resp.code != 200)
@@ -240,7 +240,7 @@ bool twitter::get_info_by_email(const std::string &email,twitter_user *info)
if(!info)
return false;
- std::string url = base_url_+"users/show.json?email="+http::url_encode(email);
+ std::string url = base_url_+"1.1/users/show.json?email="+http::url_encode(email);
http::response resp = slurp(url,http::get);
if(resp.code != 200)
@@ -265,7 +265,7 @@ bool twitter::get_info_by_email(const std::string &email,twitter_user *info)
twitter_user twitter::add_friend(const std::string &name)
{
- std::string url = base_url_+"friendships/create/"+http::url_encode(name)+".json";
+ std::string url = base_url_+"1.1/friendships/create/"+http::url_encode(name)+".json";
twitter_user ret;
http::response resp = slurp(url,http::post);
@@ -293,7 +293,7 @@ twitter_user twitter::add_friend(const std::string &name)
void twitter::remove_friend(const std::string &name)
{
- std::string url = base_url_+"friendships/destroy/"+http::url_encode(name)+".json";
+ std::string url = base_url_+"1.1/friendships/destroy/"+http::url_encode(name)+".json";
slurp(url,http::post);
}
@@ -311,7 +311,7 @@ void twitter::set_status(const std::string &text)
OAuthParameters postParams;
postParams[L"status"] = UrlEncode(wTweet);
- slurp(base_url_+"statuses/update.json",http::post, postParams);
+ slurp(base_url_+"1.1/statuses/update.json",http::post, postParams);
}
}
@@ -321,7 +321,7 @@ void twitter::send_direct(const std::string &name,const std::string &text)
OAuthParameters postParams;
postParams[L"text"] = UrlEncode(temp);
postParams[L"screen_name"] = UTF8ToWide(name);
- slurp(base_url_+"direct_messages/new.json", http::post, postParams);
+ slurp(base_url_+"1.1/direct_messages/new.json", http::post, postParams);
}
std::vector<twitter_user> twitter::get_statuses(int count,twitter_id id)
@@ -329,7 +329,7 @@ std::vector<twitter_user> twitter::get_statuses(int count,twitter_id id)
using boost::lexical_cast;
std::vector<twitter_user> statuses;
- std::string url = base_url_+"statuses/home_timeline.json?count="+
+ std::string url = base_url_+"1.1/statuses/home_timeline.json?count="+
lexical_cast<std::string>(count);
if(id != 0)
url += "&since_id="+boost::lexical_cast<std::string>(id);
@@ -355,6 +355,7 @@ std::vector<twitter_user> twitter::get_statuses(int count,twitter_id id)
u.username = retrieve<std::string>(user,"screen_name");
std::string rawText = retrieve<std::string>(one,"text");
+ bool foundTruncatedRT = false;
if (rawText.length() == 140) { // might be a truncated tweet
if (rawText.substr(0, 4) == "RT @") { // starting to look like a RT...
if (rawText.substr(136, 4) == " ...") { // ok this is the best I can do. it starts with "RT @", ends with " ...", and is the full 140 chars
@@ -371,11 +372,21 @@ std::vector<twitter_user> twitter::get_statuses(int count,twitter_id id)
std::string retweeteesName = retrieve<std::string>(RTUser,"screen_name"); // the user that is being retweeted
std::string retweetText = retrieve<std::string>(Retweet,"text"); // their tweet in all it's untruncated glory
+
+ // fix "&amp;" in the tweets :(
+ size_t pos = 0;
+ while((pos = retweetText.find("&amp;", pos)) != std::string::npos) {
+ retweetText.replace(pos, 5, "&");
+ pos += 1;
+ }
+
u.status.text = "RT @" + retweeteesName + " " + retweetText; // mash it together in some format people will understand
+ foundTruncatedRT = true;
}
}
}
- else { // if it's not truncated, then the twitter API returns the native RT correctly anyway,
+
+ if (foundTruncatedRT == false) { // if it's not truncated, then the twitter API returns the native RT correctly anyway,
//std::string twt = retrieve<std::string>(one,"text"); // no need to do this anymore, we already grabbed it above in rawText
@@ -387,7 +398,7 @@ std::vector<twitter_user> twitter::get_statuses(int count,twitter_id id)
pos += 1;
}
- u.status.text = rawText; // so we can just pretend it doesn't happen
+ u.status.text = rawText;
}
u.status.id = retrieve<long long>(one,"id");
@@ -406,7 +417,7 @@ std::vector<twitter_user> twitter::get_direct(twitter_id id)
{
std::vector<twitter_user> messages;
- std::string url = base_url_+"direct_messages.json";
+ std::string url = base_url_+"1.1/direct_messages.json";
if(id != 0)
url += "?since_id="+boost::lexical_cast<std::string>(id);
diff --git a/protocols/Twitter/src/ui.cpp b/protocols/Twitter/src/ui.cpp
index a7a0a4262b..2d1c0feb4f 100644
--- a/protocols/Twitter/src/ui.cpp
+++ b/protocols/Twitter/src/ui.cpp
@@ -24,7 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "twitter.h"
static const TCHAR *sites[] = {
- _T("https://api.twitter.com/1.1/"),
+ _T("https://api.twitter.com/"),
_T("https://identi.ca/api/")
};
diff --git a/protocols/Twitter/src/version.h b/protocols/Twitter/src/version.h
index 054af2330b..d3d3f6e21d 100644
--- a/protocols/Twitter/src/version.h
+++ b/protocols/Twitter/src/version.h
@@ -1,20 +1,20 @@
-/*
-Copyright © 2009 Jim Porter
+#define __MAJOR_VERSION 1
+#define __MINOR_VERSION 0
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 3
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 2 of the License, or
-(at your option) any later version.
+#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
+#define __FILEVERSION_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+#define __STRINGIFY_IMPL(x) #x
+#define __STRINGIFY(x) __STRINGIFY_IMPL(x)
+#define __VERSION_STRING __STRINGIFY(__FILEVERSION_DOTS)
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#pragma once
-
-#define __VERSION_DWORD PLUGIN_MAKE_VERSION(1, 0, 0, 2) \ No newline at end of file
+#define __PLUGIN_NAME "Twitter"
+#define __INTERNAL_NAME "Twitter"
+#define __FILENAME "Twitter.dll"
+#define __DESCRIPTION "Twitter protocol plugin for Miranda NG."
+#define __AUTHOR "dentist, omniwolf, Thief"
+#define __AUTHOREMAIL ""
+#define __AUTHORWEB "http://miranda-ng.org/"
+#define __COPYRIGHT "© 2009-2010 dentist, 2010-2012 omniwolf and Thief"
diff --git a/protocols/Twitter/twitter.vcxproj b/protocols/Twitter/twitter.vcxproj
index 5fed13bfd2..4c4cc5997d 100644
--- a/protocols/Twitter/twitter.vcxproj
+++ b/protocols/Twitter/twitter.vcxproj
@@ -197,6 +197,7 @@
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\twitter.rc" />
+ <ResourceCompile Include="res\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/Twitter/twitter.vcxproj.filters b/protocols/Twitter/twitter.vcxproj.filters
index a1e9502d37..2a1ef10e63 100644
--- a/protocols/Twitter/twitter.vcxproj.filters
+++ b/protocols/Twitter/twitter.vcxproj.filters
@@ -112,5 +112,8 @@
<ResourceCompile Include="res\twitter.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file