diff options
author | George Hazan <george.hazan@gmail.com> | 2025-04-23 13:50:35 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2025-04-23 13:50:35 +0300 |
commit | 6b40f4a98aef9adf12d5ed943b247b451a4de43a (patch) | |
tree | 16fcee2bea6d62fb5d96e0af953bc395b9372042 /protocols/Teams/src/teams_utils.cpp | |
parent | a82410a3c20ba13969f37d3ab14f6e8ca1067284 (diff) |
Teams: presence support
Diffstat (limited to 'protocols/Teams/src/teams_utils.cpp')
-rw-r--r-- | protocols/Teams/src/teams_utils.cpp | 68 |
1 files changed, 5 insertions, 63 deletions
diff --git a/protocols/Teams/src/teams_utils.cpp b/protocols/Teams/src/teams_utils.cpp index 8d158dfd4d..a71e9f7e4e 100644 --- a/protocols/Teams/src/teams_utils.cpp +++ b/protocols/Teams/src/teams_utils.cpp @@ -19,68 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma warning(disable:4566) -time_t CTeamsProto::IsoToUnixTime(const std::string &stamp) -{ - char date[9]; - int i, y; - - if (stamp.empty()) - return 0; - - char *p = NEWSTR_ALLOCA(stamp.c_str()); - - // skip '-' chars - int si = 0, sj = 0; - while (true) { - if (p[si] == '-') - si++; - else if (!(p[sj++] = p[si++])) - break; - } - - // Get the date part - for (i = 0; *p != '\0' && i < 8 && isdigit(*p); p++, i++) - date[i] = *p; - - // Parse year - if (i == 6) { - // 2-digit year (1970-2069) - y = (date[0] - '0') * 10 + (date[1] - '0'); - if (y < 70) y += 100; - } - else if (i == 8) { - // 4-digit year - y = (date[0] - '0') * 1000 + (date[1] - '0') * 100 + (date[2] - '0') * 10 + date[3] - '0'; - y -= 1900; - } - else return 0; - - struct tm timestamp; - timestamp.tm_year = y; - - // Parse month - timestamp.tm_mon = (date[i - 4] - '0') * 10 + date[i - 3] - '0' - 1; - - // Parse date - timestamp.tm_mday = (date[i - 2] - '0') * 10 + date[i - 1] - '0'; - - // Skip any date/time delimiter - for (; *p != '\0' && !isdigit(*p); p++); - - // Parse time - if (sscanf(p, "%d:%d:%d", ×tamp.tm_hour, ×tamp.tm_min, ×tamp.tm_sec) != 3) - return (time_t)0; - - timestamp.tm_isdst = 0; // DST is already present in _timezone below - time_t t = mktime(×tamp); - - _tzset(); - t -= _timezone; - return (t >= 0) ? t : 0; -} - -////////////////////////////////////////////////////////////////////////////////////////// - struct HtmlEntity { const char *entity; @@ -576,14 +514,18 @@ uint32_t Utf16toUtf32(const wchar_t *str) ////////////////////////////////////////////////////////////////////////////////////////// -int SkypeToMirandaStatus(const char *status) +int TeamsToMirandaStatus(const char *status) { if (!mir_strcmpi(status, "Available")) return ID_STATUS_ONLINE; + if (!mir_strcmpi(status, "Away")) + return ID_STATUS_AWAY; if (!mir_strcmpi(status, "BeRightBack")) return ID_STATUS_NA; if (!mir_strcmpi(status, "AvailableIdle")) return ID_STATUS_IDLE; + if (!mir_strcmpi(status, "Busy")) + return ID_STATUS_OCCUPIED; if (!mir_strcmpi(status, "DoNotDisturb")) return ID_STATUS_DND; return ID_STATUS_OFFLINE; |