diff options
author | Robert Pösel <robyer@seznam.cz> | 2014-03-09 08:32:54 +0000 |
---|---|---|
committer | Robert Pösel <robyer@seznam.cz> | 2014-03-09 08:32:54 +0000 |
commit | 90e99f1002599427b8373e6477073a9c8f5832c7 (patch) | |
tree | e406240e375c1106014704fa20a3872916e9bbbd | |
parent | 685bdd6028b2d01d10168b06150983e7bd8e126a (diff) |
Facebook: Add contact menu item to open "Conversation history" on website
git-svn-id: http://svn.miranda-ng.org/main/trunk@8488 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/FacebookRM/facebook_10.vcxproj | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/facebook_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/FacebookRM/facebook_12.vcxproj | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/facebook_12.vcxproj.filters | 3 | ||||
-rw-r--r-- | protocols/FacebookRM/res/conversation.ico | bin | 0 -> 1150 bytes | |||
-rw-r--r-- | protocols/FacebookRM/res/facebook.rc | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/constants.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.cpp | 20 | ||||
-rw-r--r-- | protocols/FacebookRM/src/proto.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/resource.h | 1 | ||||
-rw-r--r-- | protocols/FacebookRM/src/theme.cpp | 17 | ||||
-rw-r--r-- | protocols/FacebookRM/src/theme.h | 3 |
12 files changed, 47 insertions, 5 deletions
diff --git a/protocols/FacebookRM/facebook_10.vcxproj b/protocols/FacebookRM/facebook_10.vcxproj index 6da66bbf2a..c9a5983b5a 100644 --- a/protocols/FacebookRM/facebook_10.vcxproj +++ b/protocols/FacebookRM/facebook_10.vcxproj @@ -221,6 +221,7 @@ <Image Include="res\mind.ico" />
<Image Include="res\notification.ico" />
<Image Include="res\poke.ico" />
+ <Image Include="res\conversation.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/FacebookRM/facebook_10.vcxproj.filters b/protocols/FacebookRM/facebook_10.vcxproj.filters index cea7e77751..f0c51221bd 100644 --- a/protocols/FacebookRM/facebook_10.vcxproj.filters +++ b/protocols/FacebookRM/facebook_10.vcxproj.filters @@ -141,5 +141,8 @@ <Image Include="res\poke.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
+ <Image Include="res\conversation.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/protocols/FacebookRM/facebook_12.vcxproj b/protocols/FacebookRM/facebook_12.vcxproj index 624207a218..7dda7d5dd0 100644 --- a/protocols/FacebookRM/facebook_12.vcxproj +++ b/protocols/FacebookRM/facebook_12.vcxproj @@ -224,6 +224,7 @@ <Image Include="res\mind.ico" />
<Image Include="res\notification.ico" />
<Image Include="res\poke.ico" />
+ <Image Include="res\conversation.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/protocols/FacebookRM/facebook_12.vcxproj.filters b/protocols/FacebookRM/facebook_12.vcxproj.filters index cea7e77751..f0c51221bd 100644 --- a/protocols/FacebookRM/facebook_12.vcxproj.filters +++ b/protocols/FacebookRM/facebook_12.vcxproj.filters @@ -141,5 +141,8 @@ <Image Include="res\poke.ico">
<Filter>Resource Files\Icons</Filter>
</Image>
+ <Image Include="res\conversation.ico">
+ <Filter>Resource Files\Icons</Filter>
+ </Image>
</ItemGroup>
</Project>
\ No newline at end of file diff --git a/protocols/FacebookRM/res/conversation.ico b/protocols/FacebookRM/res/conversation.ico Binary files differnew file mode 100644 index 0000000000..5542ea51db --- /dev/null +++ b/protocols/FacebookRM/res/conversation.ico diff --git a/protocols/FacebookRM/res/facebook.rc b/protocols/FacebookRM/res/facebook.rc index c0b9467311..6223e64449 100644 --- a/protocols/FacebookRM/res/facebook.rc +++ b/protocols/FacebookRM/res/facebook.rc @@ -57,6 +57,7 @@ IDI_POKE ICON "poke.ico" IDI_NOTIFICATION ICON "notification.ico"
IDI_NEWSFEED ICON "feeds.ico"
IDI_FRIENDS ICON "friends.ico"
+IDI_CONVERSATION ICON "conversation.ico"
/////////////////////////////////////////////////////////////////////////////
//
diff --git a/protocols/FacebookRM/src/constants.h b/protocols/FacebookRM/src/constants.h index b4af81412a..83da81d108 100644 --- a/protocols/FacebookRM/src/constants.h +++ b/protocols/FacebookRM/src/constants.h @@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FACEBOOK_URL_PROFILE "http://www.facebook.com/profile.php?id="
#define FACEBOOK_URL_GROUP "http://www.facebook.com/n/?home.php&sk=group_"
#define FACEBOOK_URL_PICTURE "http://graph.facebook.com/%s/picture"
+#define FACEBOOK_URL_CONVERSATION "http://www.facebook.com/messages/"
// Connection
#define FACEBOOK_SERVER_REGULAR "www.facebook.com"
diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 10e61fc840..7ec20b4790 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -551,6 +551,26 @@ INT_PTR FacebookProto::VisitFriendship(WPARAM wParam,LPARAM lParam) return 0;
}
+INT_PTR FacebookProto::VisitConversation(WPARAM wParam, LPARAM lParam)
+{
+ MCONTACT hContact = MCONTACT(wParam);
+
+ if (wParam == 0 || !IsMyContact(hContact, true))
+ return 1;
+
+ std::string url = FACEBOOK_URL_CONVERSATION;
+
+ if (isChatRoom(hContact)) {
+ url += "conversation-";
+ url += ptrA(getStringA(hContact, FACEBOOK_KEY_TID));
+ } else {
+ url += ptrA(getStringA(hContact, FACEBOOK_KEY_ID));
+ }
+
+ OpenUrl(url);
+ return 0;
+}
+
INT_PTR FacebookProto::Poke(WPARAM wParam,LPARAM lParam)
{
if (wParam == NULL || isOffline())
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 06aae5acb4..319e08074c 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -116,6 +116,7 @@ public: INT_PTR __cdecl GetAvatarCaps(WPARAM, LPARAM);
INT_PTR __cdecl VisitProfile(WPARAM, LPARAM);
INT_PTR __cdecl VisitFriendship(WPARAM, LPARAM);
+ INT_PTR __cdecl VisitConversation(WPARAM, LPARAM);
INT_PTR __cdecl Poke(WPARAM, LPARAM);
INT_PTR __cdecl CancelFriendship(WPARAM, LPARAM);
INT_PTR __cdecl RequestFriendship(WPARAM, LPARAM);
diff --git a/protocols/FacebookRM/src/resource.h b/protocols/FacebookRM/src/resource.h index ae65552642..4c706e58e5 100644 --- a/protocols/FacebookRM/src/resource.h +++ b/protocols/FacebookRM/src/resource.h @@ -14,6 +14,7 @@ #define IDI_NOTIFICATION 128
#define IDI_NEWSFEED 129
#define IDI_FRIENDS 130
+#define IDI_CONVERSATION 131
#define IDC_UN 1001
#define IDC_PW 1002
#define IDC_NEWACCOUNTLINK 1003
diff --git a/protocols/FacebookRM/src/theme.cpp b/protocols/FacebookRM/src/theme.cpp index f9e60078ee..eb10c0d6a8 100644 --- a/protocols/FacebookRM/src/theme.cpp +++ b/protocols/FacebookRM/src/theme.cpp @@ -32,6 +32,7 @@ static IconItem icons[] = { LPGEN("Notification"), "notification", IDI_NOTIFICATION },
{ LPGEN("Newsfeed"), "newsfeed", IDI_NEWSFEED },
{ LPGEN("Friendship details"), "friendship", IDI_FRIENDS },
+ { LPGEN("Conversation history"), "conversation", IDI_CONVERSATION },
};
// TODO: uninit
@@ -101,14 +102,21 @@ void InitContactMenus() CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::VisitFriendship>);
g_hContactMenuItems[CMI_VISIT_FRIENDSHIP] = Menu_AddContactMenuItem(&mi);
- mi.position=-2000006001;
+ mi.position = -2000006002;
+ mi.icolibItem = GetIconHandle("conversation");
+ mi.pszName = LPGEN("Visit conversation history");
+ mi.pszService = "FacebookProto/VisitConversation";
+ CreateServiceFunction(mi.pszService, GlobalService<&FacebookProto::VisitConversation>);
+ g_hContactMenuItems[CMI_VISIT_CONVERSATION] = Menu_AddContactMenuItem(&mi);
+
+ mi.position=-2000006003;
mi.icolibItem = GetIconHandle("mind");
mi.pszName = LPGEN("Share status...");
mi.pszService = "FacebookProto/Mind";
CreateServiceFunction(mi.pszService,GlobalService<&FacebookProto::OnMind>);
g_hContactMenuItems[CMI_POST_STATUS] = Menu_AddContactMenuItem(&mi);
- mi.position=-2000006002;
+ mi.position=-2000006004;
mi.icolibItem = GetIconHandle("poke");
mi.pszName = LPGEN("Poke");
mi.pszService = "FacebookProto/Poke";
@@ -155,8 +163,9 @@ int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) MCONTACT hContact = MCONTACT(wParam);
bool bIsChatroom = isChatRoom(hContact);
- Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], true);
+ Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_PROFILE], !bIsChatroom);
Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_FRIENDSHIP], !bIsChatroom);
+ Menu_ShowItem(g_hContactMenuItems[CMI_VISIT_CONVERSATION], true);
Menu_ShowItem(g_hContactMenuItems[CMI_POST_STATUS], !bIsChatroom);
if (!isOffline() && !bIsChatroom)
@@ -167,7 +176,7 @@ int FacebookProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_ASK], ctrlPressed || type == CONTACT_NONE || !type);
Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_GRANT], ctrlPressed || type == CONTACT_APPROVE);
Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_REVOKE], ctrlPressed || type == CONTACT_FRIEND);
- Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == CONTACT_REQUEST);
+ Menu_ShowItem(g_hContactMenuItems[CMI_AUTH_CANCEL], ctrlPressed || type == CONTACT_REQUEST);
Menu_ShowItem(g_hContactMenuItems[CMI_POKE], true);
}
diff --git a/protocols/FacebookRM/src/theme.h b/protocols/FacebookRM/src/theme.h index 0bb0fdc129..6c3f9a566a 100644 --- a/protocols/FacebookRM/src/theme.h +++ b/protocols/FacebookRM/src/theme.h @@ -37,5 +37,6 @@ void UninitContactMenus(void); #define CMI_AUTH_CANCEL 5
#define CMI_POKE 6
#define CMI_POST_STATUS 7
+#define CMI_VISIT_CONVERSATION 8
-#define CMITEMS_COUNT 8
\ No newline at end of file +#define CMITEMS_COUNT 9
\ No newline at end of file |