From 92b9c195e5724e1bee7a85217332a72dc96309e8 Mon Sep 17 00:00:00 2001
From: MikalaiR <nikolay.romanovich@narod.ru>
Date: Mon, 20 Apr 2015 11:47:42 +0000
Subject: SkypeWeb: Call duration format.

git-svn-id: http://svn.miranda-ng.org/main/trunk@12964 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
---
 protocols/SkypeWeb/src/skype_history_sync.cpp | 18 ++++++++++++++----
 protocols/SkypeWeb/src/skype_messages.cpp     | 18 ++++++++++++++----
 2 files changed, 28 insertions(+), 8 deletions(-)

(limited to 'protocols')

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());
-- 
cgit v1.2.3