From d2b4dacd31b51c7319d8d96460a6c4fad8cd0274 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 4 Sep 2019 15:01:54 +0300 Subject: history manager built into CHAT_MANAGER isn't needed anymore --- src/mir_app/src/chat_manager.cpp | 81 ---------------------------------------- 1 file changed, 81 deletions(-) (limited to 'src/mir_app') diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 5563bee8d3..76f85012db 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -126,14 +126,6 @@ static void SM_FreeSession(SESSION_INFO *si, bool bRemoveContact = false) mir_free(si->ptszName); mir_free(si->ptszStatusbarText); mir_free(si->ptszTopic); - - while (si->lpCommands != nullptr) { - COMMANDINFO *pNext = si->lpCommands->next; - mir_free(si->lpCommands->lpCommand); - mir_free(si->lpCommands); - si->lpCommands = pNext; - } - delete si; } @@ -393,76 +385,6 @@ void SM_RemoveAll(void) } } -static void SM_AddCommand(const wchar_t *pszID, const char *pszModule, const char* lpNewCommand) -{ - SESSION_INFO *si = SM_FindSession(pszID, pszModule); - if (si == nullptr) - return; - - COMMANDINFO *node = (COMMANDINFO *)mir_alloc(sizeof(COMMANDINFO)); - node->lpCommand = mir_strdup(lpNewCommand); - node->last = nullptr; // always added at beginning! - - // new commands are added at start - if (si->lpCommands == nullptr) { - node->next = nullptr; - si->lpCommands = node; - } - else { - node->next = si->lpCommands; - si->lpCommands->last = node; // hmm, weird - si->lpCommands = node; - } - si->lpCurrentCommand = nullptr; // current command - si->wCommandsNum++; - - if (si->wCommandsNum > WINDOWS_COMMANDS_MAX) { - COMMANDINFO *pCurComm = si->lpCommands; - while (pCurComm->next != nullptr) - pCurComm = pCurComm->next; - - COMMANDINFO *pLast = pCurComm->last; - mir_free(pCurComm->lpCommand); - mir_free(pCurComm); - pLast->next = nullptr; - // done - si->wCommandsNum--; - } -} - -static char* SM_GetPrevCommand(const wchar_t *pszID, const char *pszModule) // get previous command. returns nullptr if previous command does not exist. current command remains as it was. -{ - SESSION_INFO *si = SM_FindSession(pszID, pszModule); - if (si == nullptr) - return nullptr; - - COMMANDINFO *pPrevCmd = nullptr; - if (si->lpCurrentCommand != nullptr) { - if (si->lpCurrentCommand->next != nullptr) // not nullptr - pPrevCmd = si->lpCurrentCommand->next; // next command (newest at beginning) - else - pPrevCmd = si->lpCurrentCommand; - } - else pPrevCmd = si->lpCommands; - - si->lpCurrentCommand = pPrevCmd; // make it the new command - return (pPrevCmd) ? pPrevCmd->lpCommand : nullptr; -} - -static char* SM_GetNextCommand(const wchar_t *pszID, const char *pszModule) // get next command. returns nullptr if next command does not exist. current command becomes nullptr (a prev command after this one will get you the last command) -{ - SESSION_INFO *si = SM_FindSession(pszID, pszModule); - if (si == nullptr) - return nullptr; - - COMMANDINFO *pNextCmd = nullptr; - if (si->lpCurrentCommand != nullptr) - pNextCmd = si->lpCurrentCommand->last; // last command (newest at beginning) - - si->lpCurrentCommand = pNextCmd; // make it the new command - return (pNextCmd) ? pNextCmd->lpCommand : nullptr; -} - static int SM_GetCount(const char *pszModule) { int count = 0; @@ -948,9 +870,6 @@ static void ResetApi() g_chatApi.SM_FindSession = ::SM_FindSession; g_chatApi.SM_GetStatusIcon = ::SM_GetStatusIcon; g_chatApi.SM_BroadcastMessage = ::SM_BroadcastMessage; - g_chatApi.SM_AddCommand = ::SM_AddCommand; - g_chatApi.SM_GetPrevCommand = ::SM_GetPrevCommand; - g_chatApi.SM_GetNextCommand = ::SM_GetNextCommand; g_chatApi.SM_GetCount = ::SM_GetCount; g_chatApi.SM_FindSessionByIndex = ::SM_FindSessionByIndex; g_chatApi.SM_GetUserFromIndex = ::SM_GetUserFromIndex; -- cgit v1.2.3