diff options
author | George Hazan <ghazan@miranda.im> | 2022-05-25 14:29:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2022-05-25 14:29:57 +0300 |
commit | bf12e0e79a7b27f6e8688ab031f70449f25b190e (patch) | |
tree | bd7929155be134d4b1b99fce8096484dd018456e /protocols/JabberG/src/jabber_iq_handlers.cpp | |
parent | d46738ce43184a2ca07e00a77859f17698713645 (diff) |
Jabber: patch from deadsend to optionally disable XEP-0202 support
Diffstat (limited to 'protocols/JabberG/src/jabber_iq_handlers.cpp')
-rw-r--r-- | protocols/JabberG/src/jabber_iq_handlers.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index 6d0d2e099e..6c02b89986 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -106,12 +106,14 @@ int GetGMTOffset(void) // entity time (XEP-0202) support
bool CJabberProto::OnIqRequestTime(const TiXmlElement*, CJabberIqInfo *pInfo)
{
- wchar_t stime[100];
- wchar_t szTZ[10];
+ if (!m_bAllowTimeReplies)
+ return false;
+ wchar_t stime[100];
TimeZone_PrintDateTime(UTC_TIME_HANDLE, L"I", stime, _countof(stime), 0);
int nGmtOffset = GetGMTOffset();
+ wchar_t szTZ[10];
mir_snwprintf(szTZ, L"%+03d:%02d", nGmtOffset / 60, nGmtOffset % 60);
XmlNodeIq iq("result", pInfo);
@@ -128,17 +130,20 @@ bool CJabberProto::OnIqRequestTime(const TiXmlElement*, CJabberIqInfo *pInfo) bool CJabberProto::OnIqProcessIqOldTime(const TiXmlElement*, CJabberIqInfo *pInfo)
{
- struct tm *gmt;
- time_t ltime;
- char stime[100], *dtime;
+ if (!m_bAllowTimeReplies)
+ return false;
_tzset();
+ time_t ltime;
time(<ime);
- gmt = gmtime(<ime);
+
+ struct tm *gmt = gmtime(<ime);
+
+ char stime[100];
mir_snprintf(stime, "%.4i%.2i%.2iT%.2i:%.2i:%.2i",
gmt->tm_year + 1900, gmt->tm_mon + 1,
gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec);
- dtime = ctime(<ime);
+ char *dtime = ctime(<ime);
dtime[24] = 0;
XmlNodeIq iq("result", pInfo);
|