diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 11:47:42 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-20 11:47:42 +0000 |
commit | 92b9c195e5724e1bee7a85217332a72dc96309e8 (patch) | |
tree | b92acd9832d79c9e48da0e3471c062171cc55c22 | |
parent | 3e807a1b4ed2e9bcdf557660e0c1f8a4692747a7 (diff) |
SkypeWeb: Call duration format.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12964 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_history_sync.cpp | 18 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 18 |
2 files changed, 28 insertions, 8 deletions
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index ed75061658..ff0e6f9a0d 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -126,11 +126,21 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) text.Append(Translate("Call started"));
else if (iType == 0)
{
+ CMStringA chours = "", cmins = "", csec = "";
int hours=0, mins=0, sec=0;
- hours = iDuration != NULL ? iDuration / 3600 : 0;
- mins = iDuration != NULL ? iDuration / 60 : 0;
- sec = iDuration != NULL ? iDuration % 60 : 0;
- text.AppendFormat("%s\n%s: %d:%d:%d", Translate("Call ended"), Translate("Duration"), hours, mins, sec);
+ if (iDuration != NULL)
+ {
+ hours = iDuration / 3600;
+ mins = iDuration / 60;
+ sec = iDuration % 60;
+ }
+ else
+ hours=mins=sec=0;
+
+ if (hours < 10) chours.AppendFormat("0%d", hours); else chours.AppendFormat("%d", hours);
+ if (mins < 10) cmins.AppendFormat("0%d", mins); else cmins.AppendFormat("%d", mins);
+ if (sec < 10) csec.AppendFormat("0%d", sec); else csec.AppendFormat("%d", sec);
+ text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec);
}
AddMessageToDb(hContact, timestamp, flags, clientMsgId, text.GetBuffer());
}
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 21d04586f3..aef8687f78 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -285,11 +285,21 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node) text.Append(Translate("Call started"));
else if (iType == 0)
{
+ CMStringA chours = "", cmins = "", csec = "";
int hours=0, mins=0, sec=0;
- hours = iDuration != NULL ? iDuration / 3600 : 0;
- mins = iDuration != NULL ? iDuration / 60 : 0;
- sec = iDuration != NULL ? iDuration % 60 : 0;
- text.AppendFormat("%s\n%s: %d:%d:%d", Translate("Call ended"), Translate("Duration"), hours, mins, sec);
+ if (iDuration != NULL)
+ {
+ hours = iDuration / 3600;
+ mins = iDuration / 60;
+ sec = iDuration % 60;
+ }
+ else
+ hours=mins=sec=0;
+
+ if (hours < 10) chours.AppendFormat("0%d", hours); else chours.AppendFormat("%d", hours);
+ if (mins < 10) cmins.AppendFormat("0%d", mins); else cmins.AppendFormat("%d", mins);
+ if (sec < 10) csec.AppendFormat("0%d", sec); else csec.AppendFormat("%d", sec);
+ text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec);
}
if (IsMe(from))
AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, text.GetBuffer());
|