diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/ExternalAPI/m_NewStory.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/res/reply.ico | bin | 0 -> 4286 bytes | |||
-rw-r--r-- | plugins/NewStory/res/resource.rc | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 7 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 19 | ||||
-rw-r--r-- | plugins/NewStory/src/main.cpp | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/resource.h | 3 |
8 files changed, 32 insertions, 3 deletions
diff --git a/plugins/ExternalAPI/m_NewStory.h b/plugins/ExternalAPI/m_NewStory.h index ef2a247426..00bf7b6e44 100644 --- a/plugins/ExternalAPI/m_NewStory.h +++ b/plugins/ExternalAPI/m_NewStory.h @@ -2,6 +2,8 @@ #include <vector> +#define NS_PROTO_MENU_POS 1000001 + enum { NSM_FIRST = WM_USER + 100, diff --git a/plugins/NewStory/res/reply.ico b/plugins/NewStory/res/reply.ico Binary files differnew file mode 100644 index 0000000000..16cbee7a06 --- /dev/null +++ b/plugins/NewStory/res/reply.ico diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc index 9cbb0b2603..7caf81eff9 100644 --- a/plugins/NewStory/res/resource.rc +++ b/plugins/NewStory/res/resource.rc @@ -72,6 +72,8 @@ IDI_OK ICON "ok.ico" IDI_USERS ICON "users.ico" +IDI_REPLY ICON "reply.ico" + ///////////////////////////////////////////////////////////////////////////// // diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index dfa7669dee..8de1503e1b 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -637,6 +637,13 @@ void NewstoryListData::Quote() } } +void NewstoryListData::Reply() +{ + if (pMsgDlg) + if (auto *pItem = GetItem(caret)) + pMsgDlg->SetQuoteEvent(pItem->hEvent); +} + void NewstoryListData::ScheduleDraw() { bWasAtBottom = AtBottom(); diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h index 85bc06f2aa..a6c87e6622 100644 --- a/plugins/NewStory/src/history_control.h +++ b/plugins/NewStory/src/history_control.h @@ -70,6 +70,7 @@ struct NewstoryListData : public MZeroedObject int PaintItem(HDC hdc, int index, int top, int width); void Quote(); void RecalcScrollBar(); + void Reply(); void ScheduleDraw(); void ScrollBottom(); void ScrollDown(int deltaY); diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index 4e6f67d1c4..df6ae94f48 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -22,14 +22,14 @@ enum { MENU_COPY, MENU_COPYTEXT, MENU_COPYURL, MENU_OPENFOLDER, MENU_QUOTE, MENU_SAVEAS, MENU_DOWNLOAD, - MENU_EDIT, MENU_DELETE, + MENU_EDIT, MENU_DELETE, MENU_REPLY, MENU_SELECTALL, MENU_BOOKMARK, }; static int hMenuObject; static HANDLE hEventPreBuildMenu; static HGENMENU hmiHistory, hmiOpenFolder, hmiCopyUrl, hmiSaveAs, hmiDownload, hmiQuote; -static HGENMENU hmiCopy, hmiCopyText, hmiEdit, hmiBookmark, hmiDelete; +static HGENMENU hmiCopy, hmiCopyText, hmiEdit, hmiBookmark, hmiDelete, hmiReply; HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) { @@ -42,6 +42,7 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) Menu_ShowItem(hmiCopyText, bNotProtected); Menu_ShowItem(hmiQuote, bNotProtected && data->pMsgDlg != nullptr); + Menu_ShowItem(hmiReply, false); Menu_ShowItem(hmiSaveAs, false); Menu_ShowItem(hmiCopyUrl, false); Menu_ShowItem(hmiDownload, false); @@ -62,6 +63,11 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) DB::EventInfo dbei(item->hEvent); NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&dbei); + + if (data->pMsgDlg) { + INT_PTR caps = CallProtoService(Proto_GetBaseAccountName(item->hContact), PS_GETCAPS, PFLAGNUM_4, 0); + Menu_ShowItem(hmiReply, (caps & PF4_REPLY) != 0 && mir_strlen(dbei.szId) > 0 && !Contact::IsReadonly(item->hContact)); + } } else { bShowEventActions = bEditable = false; @@ -118,6 +124,10 @@ static INT_PTR NSMenuHelper(WPARAM wParam, LPARAM lParam) pData->Quote(); break; + case MENU_REPLY: + pData->Reply(); + break; + case MENU_EDIT: pData->BeginEditItem(); break; @@ -274,4 +284,9 @@ void InitMenus() mi.position = 300000; mi.name.a = LPGEN("Select all"); Menu_AddNewStoryMenuItem(&mi, MENU_SELECTALL); + + mi.position = NS_PROTO_MENU_POS - 1; + mi.hIcolibItem = g_plugin.getIconHandle(IDI_REPLY); + mi.name.a = LPGEN("Reply"); + hmiReply = Menu_AddNewStoryMenuItem(&mi, MENU_REPLY); } diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp index dbcadd015e..bb09d38e40 100644 --- a/plugins/NewStory/src/main.cpp +++ b/plugins/NewStory/src/main.cpp @@ -64,6 +64,7 @@ static IconItem icons[] = { LPGEN("Filter"), "filter", IDI_FILTER }, { LPGEN("Export"), "export", IDI_EXPORT }, { LPGEN("Copy"), "copy", IDI_COPY }, + { LPGEN("Reply"), "reply", IDI_REPLY }, { LPGEN("Bookmark"), "bookmark", IDI_BOOKMARK }, { LPGEN("Send message"), "message", IDI_SENDMSG }, diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h index 647d4d360c..6d9166f5ec 100644 --- a/plugins/NewStory/src/resource.h +++ b/plugins/NewStory/src/resource.h @@ -30,6 +30,7 @@ #define IDI_USERS 127 #define IDI_VARHELP 128 #define IDI_TIMETREE 129 +#define IDI_REPLY 130 #define IDC_USERINFO 1000 #define IDC_USERMENU 1001 #define IDC_MESSAGE 1002 @@ -111,7 +112,7 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 130 +#define _APS_NEXT_RESOURCE_VALUE 131 #define _APS_NEXT_COMMAND_VALUE 40019 #define _APS_NEXT_CONTROL_VALUE 1061 #define _APS_NEXT_SYMED_VALUE 101 |