From ca8719b42bbe37a5fa355d99a3dc6a65643f19cd Mon Sep 17 00:00:00 2001 From: Andrey Prygunkov Date: Sun, 27 May 2012 12:59:51 +0000 Subject: [PATCH] fixed: after renaming of a group, the new name was not displayed by remote commands <-L G> and <-C in curses mode> --- BinRpc.cpp | 4 ++++ MessageBase.h | 4 +++- RemoteClient.cpp | 15 ++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/BinRpc.cpp b/BinRpc.cpp index 88087fb5..5db44eee 100644 --- a/BinRpc.cpp +++ b/BinRpc.cpp @@ -398,6 +398,7 @@ void ListBinCommand::Execute() { NZBInfo* pNZBInfo = *it; bufsize += strlen(pNZBInfo->GetFilename()) + 1; + bufsize += strlen(pNZBInfo->GetUserNZBName()) + 1; bufsize += strlen(pNZBInfo->GetDestDir()) + 1; bufsize += strlen(pNZBInfo->GetCategory()) + 1; bufsize += strlen(pNZBInfo->GetQueuedFilename()) + 1; @@ -442,12 +443,15 @@ void ListBinCommand::Execute() pListAnswer->m_iSizeLo = htonl(iSizeLo); pListAnswer->m_iSizeHi = htonl(iSizeHi); pListAnswer->m_iFilenameLen = htonl(strlen(pNZBInfo->GetFilename()) + 1); + pListAnswer->m_iUserNZBNameLen = htonl(strlen(pNZBInfo->GetUserNZBName()) + 1); pListAnswer->m_iDestDirLen = htonl(strlen(pNZBInfo->GetDestDir()) + 1); pListAnswer->m_iCategoryLen = htonl(strlen(pNZBInfo->GetCategory()) + 1); pListAnswer->m_iQueuedFilenameLen = htonl(strlen(pNZBInfo->GetQueuedFilename()) + 1); bufptr += sizeof(SNZBListResponseNZBEntry); strcpy(bufptr, pNZBInfo->GetFilename()); bufptr += ntohl(pListAnswer->m_iFilenameLen); + strcpy(bufptr, pNZBInfo->GetUserNZBName()); + bufptr += ntohl(pListAnswer->m_iUserNZBNameLen); strcpy(bufptr, pNZBInfo->GetDestDir()); bufptr += ntohl(pListAnswer->m_iDestDirLen); strcpy(bufptr, pNZBInfo->GetCategory()); diff --git a/MessageBase.h b/MessageBase.h index 713f7808..b97efaef 100644 --- a/MessageBase.h +++ b/MessageBase.h @@ -27,7 +27,7 @@ #ifndef MESSAGEBASE_H #define MESSAGEBASE_H -static const int32_t NZBMESSAGE_SIGNATURE = 0x6E7A620B; // = "nzbB" (protocol version) +static const int32_t NZBMESSAGE_SIGNATURE = 0x6E7A620C; // = "nzbC" (protocol version) static const int NZBREQUESTFILENAMESIZE = 512; static const int NZBREQUESTPASSWORDSIZE = 32; @@ -189,10 +189,12 @@ struct SNZBListResponseNZBEntry int32_t m_iSizeLo; // Size of all files in bytes, Low 32-bits of 64-bit value int32_t m_iSizeHi; // Size of all files in bytes, High 32-bits of 64-bit value int32_t m_iFilenameLen; // Length of Filename-string (m_szFilename), following to this record + int32_t m_iUserNZBNameLen; // Length of renamed NZBName-string (m_szUserNZBName), following to this record int32_t m_iDestDirLen; // Length of DestDir-string (m_szDestDir), following to this record int32_t m_iCategoryLen; // Length of Category-string (m_szCategory), following to this record int32_t m_iQueuedFilenameLen; // Length of queued file name (m_szQueuedFilename), following to this record //char m_szFilename[m_iFilenameLen]; // variable sized + //char m_szUserNZBName[m_iUserNZBNameLen]; // variable sized //char m_szDestDir[m_iDestDirLen]; // variable sized //char m_szCategory[m_iCategoryLen]; // variable sized //char m_szQueuedFilename[m_iQueuedFilenameLen]; // variable sized diff --git a/RemoteClient.cpp b/RemoteClient.cpp index 8011bd10..75d69b6e 100644 --- a/RemoteClient.cpp +++ b/RemoteClient.cpp @@ -232,13 +232,18 @@ void RemoteClient::BuildFileList(SNZBListResponse* pListResponse, const char* pT SNZBListResponseNZBEntry* pListAnswer = (SNZBListResponseNZBEntry*) pBufPtr; const char* szFileName = pBufPtr + sizeof(SNZBListResponseNZBEntry); - const char* szDestDir = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen); - const char* szCategory = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + ntohl(pListAnswer->m_iDestDirLen); - const char* m_szQueuedFilename = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + ntohl(pListAnswer->m_iDestDirLen) + ntohl(pListAnswer->m_iCategoryLen); + const char* szUserNZBName = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen); + const char* szDestDir = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + + ntohl(pListAnswer->m_iUserNZBNameLen); + const char* szCategory = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + + ntohl(pListAnswer->m_iUserNZBNameLen) + ntohl(pListAnswer->m_iDestDirLen); + const char* m_szQueuedFilename = pBufPtr + sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + + ntohl(pListAnswer->m_iUserNZBNameLen) + ntohl(pListAnswer->m_iDestDirLen) + ntohl(pListAnswer->m_iCategoryLen); NZBInfo* pNZBInfo = new NZBInfo(); pNZBInfo->SetSize(Util::JoinInt64(ntohl(pListAnswer->m_iSizeHi), ntohl(pListAnswer->m_iSizeLo))); pNZBInfo->SetFilename(szFileName); + pNZBInfo->SetUserNZBName(szUserNZBName); pNZBInfo->SetDestDir(szDestDir); pNZBInfo->SetCategory(szCategory); pNZBInfo->SetQueuedFilename(m_szQueuedFilename); @@ -247,8 +252,8 @@ void RemoteClient::BuildFileList(SNZBListResponse* pListResponse, const char* pT pDownloadQueue->GetNZBInfoList()->Add(pNZBInfo); pBufPtr += sizeof(SNZBListResponseNZBEntry) + ntohl(pListAnswer->m_iFilenameLen) + - ntohl(pListAnswer->m_iDestDirLen) + ntohl(pListAnswer->m_iCategoryLen) + - ntohl(pListAnswer->m_iQueuedFilenameLen); + ntohl(pListAnswer->m_iUserNZBNameLen) + ntohl(pListAnswer->m_iDestDirLen) + + ntohl(pListAnswer->m_iCategoryLen) + ntohl(pListAnswer->m_iQueuedFilenameLen); } //read ppp entries