summaryrefslogtreecommitdiff
path: root/protocols/JabberG/src/jabber_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/JabberG/src/jabber_util.cpp')
-rw-r--r--protocols/JabberG/src/jabber_util.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 2b37a1c864..d9a5a0695e 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -98,19 +98,10 @@ TCHAR* __stdcall JabberNickFromJID(const TCHAR *jid)
return mir_tstrdup(_T(""));
const TCHAR *p;
- TCHAR *nick;
-
if ((p = _tcschr(jid, '@')) == NULL)
p = _tcschr(jid, '/');
- if (p != NULL) {
- if ((nick = (TCHAR*)mir_alloc(sizeof(TCHAR)*(int(p - jid) + 1))) != NULL) {
- _tcsncpy_s(nick, p - jid, jid, _TRUNCATE);
- nick[p - jid] = '\0';
- }
- }
- else nick = mir_tstrdup(jid);
- return nick;
+ return (p != NULL) ? mir_tstrndup(jid, p - jid) : mir_tstrdup(jid);
}
pResourceStatus CJabberProto::ResourceInfoFromJID(const TCHAR *jid)