| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include <time.h> | 11 #include <time.h> |
| 12 #include <sstream> | 12 #include <sstream> |
| 13 #include "webrtc/libjingle/xmpp/constants.h" | 13 #include "webrtc/libjingle/xmpp/constants.h" |
| 14 #include "webrtc/libjingle/xmpp/presenceouttask.h" | 14 #include "webrtc/libjingle/xmpp/presenceouttask.h" |
| 15 #include "webrtc/libjingle/xmpp/xmppclient.h" | 15 #include "webrtc/libjingle/xmpp/xmppclient.h" |
| 16 #include "webrtc/base/arraysize.h" |
| 16 #include "webrtc/base/stringencode.h" | 17 #include "webrtc/base/stringencode.h" |
| 17 | 18 |
| 18 namespace buzz { | 19 namespace buzz { |
| 19 | 20 |
| 20 XmppReturnStatus | 21 XmppReturnStatus |
| 21 PresenceOutTask::Send(const PresenceStatus & s) { | 22 PresenceOutTask::Send(const PresenceStatus & s) { |
| 22 if (GetState() != STATE_INIT && GetState() != STATE_START) | 23 if (GetState() != STATE_INIT && GetState() != STATE_START) |
| 23 return XMPP_RETURN_BADSTATE; | 24 return XMPP_RETURN_BADSTATE; |
| 24 | 25 |
| 25 XmlElement * presence = TranslateStatus(s); | 26 XmlElement * presence = TranslateStatus(s); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 122 |
| 122 // Put the delay mark on the presence according to JEP-0091 | 123 // Put the delay mark on the presence according to JEP-0091 |
| 123 { | 124 { |
| 124 result->AddElement(new XmlElement(kQnDelayX, true)); | 125 result->AddElement(new XmlElement(kQnDelayX, true)); |
| 125 | 126 |
| 126 // This here is why we *love* the C runtime | 127 // This here is why we *love* the C runtime |
| 127 time_t current_time_seconds; | 128 time_t current_time_seconds; |
| 128 time(¤t_time_seconds); | 129 time(¤t_time_seconds); |
| 129 struct tm* current_time = gmtime(¤t_time_seconds); | 130 struct tm* current_time = gmtime(¤t_time_seconds); |
| 130 char output[256]; | 131 char output[256]; |
| 131 strftime(output, ARRAY_SIZE(output), "%Y%m%dT%H:%M:%S", current_time); | 132 strftime(output, arraysize(output), "%Y%m%dT%H:%M:%S", current_time); |
| 132 result->AddAttr(kQnStamp, output, 1); | 133 result->AddAttr(kQnStamp, output, 1); |
| 133 } | 134 } |
| 134 } | 135 } |
| 135 | 136 |
| 136 return result; | 137 return result; |
| 137 } | 138 } |
| 138 | 139 |
| 139 | 140 |
| 140 } | 141 } |
| OLD | NEW |