summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-03-05 18:15:29 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-03-05 18:15:29 +0300
commitff7f56df48d8e43e5037db68b411e453214792c8 (patch)
treeeef3ee1e73992638aebff78b90d3bc70ab18e32d
parente81e8160a681b600ec404afa443f23da455e4227 (diff)
fixes #4262 (NewStory doesn't show user nicks in Telegram chat history)
-rw-r--r--plugins/NewStory/src/history_array.cpp18
-rw-r--r--plugins/NewStory/src/history_array.h2
2 files changed, 15 insertions, 5 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 61209fa455..e82dade5aa 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -525,6 +525,8 @@ void HistoryArray::addChatEvent(SESSION_INFO *si, const LOGINFO *lin)
if (si->pMI->bDatabase && lin->hEvent) {
p.hEvent = lin->hEvent;
p.load();
+ if (p.dbe.szUserId)
+ addNick(p, Utf2T(p.dbe.szUserId));
}
else {
CMStringW wszText;
@@ -565,11 +567,8 @@ void HistoryArray::addChatEvent(SESSION_INFO *si, const LOGINFO *lin)
}
if (lin->ptszNick) {
- p.wszNick = strings.find(lin->ptszNick);
- if (p.wszNick == nullptr) {
- p.wszNick = mir_wstrdup(lin->ptszNick);
- strings.insert(p.wszNick);
- }
+ addNick(p, lin->ptszNick);
+
p.checkPrevGC((numItems == 0) ? nullptr : get(numItems - 1), hwndOwner);
}
}
@@ -605,6 +604,15 @@ bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count)
return true;
}
+void HistoryArray::addNick(ItemData &pItem, wchar_t *pwszNick)
+{
+ pItem.wszNick = strings.find(pwszNick);
+ if (pItem.wszNick == nullptr) {
+ pItem.wszNick = mir_wstrdup(pwszNick);
+ strings.insert(pItem.wszNick);
+ }
+}
+
void HistoryArray::addResults(const OBJLIST<SearchResult> &pArray)
{
int numItems = getCount();
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index df0142308f..04c7be3cd4 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -140,6 +140,8 @@ public:
bool addEvent(MCONTACT hContact, MEVENT hEvent, int count);
void addChatEvent(SESSION_INFO *si, const LOGINFO *pEvent);
void addResults(const OBJLIST<SearchResult> &pArray);
+
+ void addNick(ItemData &pItem, wchar_t *pwszNick);
void clear();
int find(MEVENT hEvent);
int find(int id, int dir, const Filter &filter);