From acfe02b246ab39f97bf77a0f3a11fc97e3f7fb3d Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Mon, 25 Mar 2019 18:17:38 +0300
Subject: Jabber: error popup's title to carry account name

---
 protocols/JabberG/src/jabber_groupchat.cpp        | 2 +-
 protocols/JabberG/src/jabber_iqid.cpp             | 4 ++--
 protocols/JabberG/src/jabber_message_handlers.cpp | 2 +-
 protocols/JabberG/src/jabber_misc.cpp             | 8 +++++++-
 protocols/JabberG/src/jabber_thread.cpp           | 4 ++--
 5 files changed, 13 insertions(+), 7 deletions(-)

(limited to 'protocols/JabberG')

diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index cf416c96c1..42d968d7c5 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -1001,7 +1001,7 @@ void CJabberProto::GroupchatProcessPresence(const TiXmlElement *node)
 			return;
 		}
 
-		MsgPopup(0, str, TranslateT("Jabber Error"));
+		MsgPopup(0, str, TranslateT("Error"));
 
 		if (item != nullptr && !item->bChatActive)
 			ListRemove(LIST_CHATROOM, from);
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 988278fca4..5b82a7d45b 100755
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -253,7 +253,7 @@ void CJabberProto::OnIqResultGetAuth(const TiXmlElement *iqNode, CJabberIqInfo*)
 
 		wchar_t text[128];
 		mir_snwprintf(text, TranslateT("Authentication failed for %s."), m_ThreadInfo->conn.username);
-		MsgPopup(0, text, TranslateT("Jabber Authentication"));
+		MsgPopup(0, text, TranslateT("Authentication"));
 		JLoginFailed(LOGINERR_WRONGPASSWORD);
 		m_ThreadInfo = nullptr;	// To disallow auto reconnect
 	}
@@ -281,7 +281,7 @@ void CJabberProto::OnIqResultSetAuth(const TiXmlElement *iqNode, CJabberIqInfo*)
 
 		wchar_t text[128];
 		mir_snwprintf(text, TranslateT("Authentication failed for %s."), Utf2T(m_ThreadInfo->conn.username).get());
-		MsgPopup(0, text, TranslateT("Jabber Authentication"));
+		MsgPopup(0, text, TranslateT("Authentication"));
 		
 		JLoginFailed(LOGINERR_WRONGPASSWORD);
 		m_ThreadInfo = nullptr;	// To disallow auto reconnect
diff --git a/protocols/JabberG/src/jabber_message_handlers.cpp b/protocols/JabberG/src/jabber_message_handlers.cpp
index 1131d81c6a..d5986c2a1c 100644
--- a/protocols/JabberG/src/jabber_message_handlers.cpp
+++ b/protocols/JabberG/src/jabber_message_handlers.cpp
@@ -45,7 +45,7 @@ BOOL CJabberProto::OnMessageError(const TiXmlElement *node, ThreadData*, CJabber
 			else
 				mir_snwprintf(buf, L"%s:\n%s", pInfo->GetFrom(), szErrText.c_str());
 
-			MsgPopup(0, buf, TranslateT("Jabber Error"));
+			MsgPopup(0, buf, TranslateT("Error"));
 		}
 	}
 	return TRUE;
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 3417f7195b..1366e7c81c 100755
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -428,8 +428,14 @@ void CJabberProto::MsgPopup(MCONTACT hContact, const wchar_t *szMsg, const wchar
 	char name[256];
 	mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
 
+	CMStringW wszTitle(szTitle);
+	if (hContact == 0) {
+		wszTitle.Insert(0, L": ");
+		wszTitle.Insert(0, m_tszUserName);
+	}
+
 	POPUPDATACLASS ppd = { sizeof(ppd) };
-	ppd.szTitle.w = szTitle;
+	ppd.szTitle.w = wszTitle;
 	ppd.szText.w = szMsg;
 	ppd.pszClassName = name;
 	ppd.hContact = hContact;
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 844ac3a1a1..0c0941c531 100755
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -665,7 +665,7 @@ void CJabberProto::PerformAuthentication(ThreadData *info)
 
 		char text[1024];
 		mir_snprintf(text, TranslateU("Authentication failed for %s@%s."), info->conn.username, info->conn.server);
-		MsgPopup(0, Utf2T(text), TranslateT("Jabber Authentication"));
+		MsgPopup(0, Utf2T(text), TranslateT("Authentication"));
 	
 		JLoginFailed(LOGINERR_WRONGPASSWORD);
 		info->send("</stream:stream>");
@@ -821,7 +821,7 @@ void CJabberProto::OnProcessError(const TiXmlElement *node, ThreadData *info)
 		}
 	}
 	if (!skipMsg)
-		MsgPopup(0, Utf2T(buff), TranslateT("Jabber Error"));
+		MsgPopup(0, Utf2T(buff), TranslateT("Error"));
 
 	if (m_bEnableStreamMgmt) //TODO: check if needed/work here
 		m_StrmMgmt.SendAck();
-- 
cgit v1.2.3