diff --git a/checkin_notes b/checkin_notes index 84c8f34e9f..93dbcd1aec 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2226,3 +2226,10 @@ David 29 Mar 2010 lib/ gui_rpc_client.h gui_rpc_client_ops.cpp + +Charlie 29 Mar 2010 + - MGR: Call get_notices RPC once per minute when Notices tab is not open + so we can notify the user when new notices become available. + + clientgui/ + MainDocument.cpp, .h diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index db15b7cba6..1e98959c0f 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -54,7 +54,10 @@ //m_dtCachedStateTimestamp #define STATERPC_INTERVAL 3600 -//m_dtProjecStatusTimestamp +//m_dtNoticesTimeStamp +#define NOTICESBACKGROUNDRPC_INTERVAL 60 + +//m_dtProjectsStatusTimestamp #define PROJECTSTATUSRPC_INTERVAL 1 //m_dtResultsTimestamp @@ -397,6 +400,9 @@ CMainDocument::CMainDocument() : rpc(this) { m_dtCachedCCStatusTimestamp = wxDateTime((time_t)0); m_iGet_status_rpc_result = 0; + m_dtNoticesTimeStamp = wxDateTime((time_t)0);; + m_iGet_notices_rpc_result = -1; + m_dtProjectsStatusTimestamp = wxDateTime((time_t)0); m_iGet_project_status1_rpc_result = -1; @@ -408,7 +414,6 @@ CMainDocument::CMainDocument() : rpc(this) { m_iGet_file_transfers_rpc_result = 0; m_iGet_messages_rpc_result = -1; - m_iGet_notices_rpc_result = -1; m_dtDiskUsageTimestamp = wxDateTime((time_t)0); m_iGet_dsk_usage_rpc_result = -1; @@ -792,7 +797,7 @@ void CMainDocument::RefreshRPCs() { m_dtProjectsStatusTimestamp = wxDateTime((time_t)1); // m_iGet_project_status1_rpc_result = -1; } - + if (!m_dtResultsTimestamp.IsEqualTo(wxDateTime((time_t)0))) { m_dtResultsTimestamp = wxDateTime((time_t)1); // m_iGet_results_rpc_result = -1; @@ -919,6 +924,27 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) { RequestRPC(request); + // *********** RPC_GET_NOTICES ************** + + // We must keep getting notices even if the Notices Tab is not open + // so we can notify the user when new notices become available. + ts = dtNow - m_dtNoticesTimeStamp; + if ((currentTabView & VW_NOTIF) || + (ts.GetSeconds() >= NOTICESBACKGROUNDRPC_INTERVAL)) { + + request.clear(); + request.which_rpc = RPC_GET_NOTICES; + // m_iNoticeSequenceNumber could change between request and execution + // of RPC, so pass in a pointer rather than its value + request.arg1 = &m_iNoticeSequenceNumber; + request.arg2 = ¬ices; + request.rpcType = RPC_TYPE_ASYNC_WITH_REFRESH_AFTER; + request.completionTime = &m_dtNoticesTimeStamp; + request.resultPtr = &m_iGet_notices_rpc_result; + + RequestRPC(request); + } + ts = dtNow - m_dtCachedStateTimestamp; if (ts.GetSeconds() >= STATERPC_INTERVAL) { @@ -981,22 +1007,6 @@ void CMainDocument::RunPeriodicRPCs(int frameRefreshRate) { } } - // *********** RPC_GET_NOTICES ************** - - if (currentTabView & VW_NOTIF) { - request.clear(); - request.which_rpc = RPC_GET_NOTICES; - // m_iNoticeSequenceNumber could change between request and execution - // of RPC, so pass in a pointer rather than its value - request.arg1 = &m_iNoticeSequenceNumber; - request.arg2 = ¬ices; - request.rpcType = RPC_TYPE_ASYNC_WITH_REFRESH_AFTER; - request.completionTime = NULL; - request.resultPtr = &m_iGet_notices_rpc_result; - - RequestRPC(request); - } - // *********** RPC_GET_RESULTS ************** if (currentTabView & VW_TASK) { diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index ed22a05e9e..d9cc4fbf66 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -289,7 +289,7 @@ public: // Notices Tab // private: - + wxDateTime m_dtNoticesTimeStamp; public: NOTICES notices;