diff options
author | fiaxh <git@mx.ax.lt> | 2017-03-10 17:01:45 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-03-10 17:11:25 +0100 |
commit | 2fe8489d368a371aefbfbe66e74621a8df14cdc2 (patch) | |
tree | 4dec90236b28101383753ffe4a1c7a34b09b0208 /vala-xmpp/src/module/xep/0082_date_time_profiles.vala | |
parent | 7a1aa8c806a63cfd031c082524501e26d4a181ee (diff) | |
download | dino-2fe8489d368a371aefbfbe66e74621a8df14cdc2.tar.gz dino-2fe8489d368a371aefbfbe66e74621a8df14cdc2.zip |
Rename vala-xmpp library to xmpp-vala
Diffstat (limited to 'vala-xmpp/src/module/xep/0082_date_time_profiles.vala')
-rw-r--r-- | vala-xmpp/src/module/xep/0082_date_time_profiles.vala | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/vala-xmpp/src/module/xep/0082_date_time_profiles.vala b/vala-xmpp/src/module/xep/0082_date_time_profiles.vala deleted file mode 100644 index b2ce1077..00000000 --- a/vala-xmpp/src/module/xep/0082_date_time_profiles.vala +++ /dev/null @@ -1,41 +0,0 @@ -namespace Xmpp.Xep.DateTimeProfiles { - - public class Module { - public Regex DATETIME_REGEX; - - public Module() { - DATETIME_REGEX = new Regex("""^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.(\d{3}))?(Z|((\+|\-)(\d{2}):(\d{2})))$"""); - } - - public DateTime? parse_string(string time_string) { - MatchInfo match_info; - if (DATETIME_REGEX.match(time_string, RegexMatchFlags.ANCHORED, out match_info)) { - int year = int.parse(match_info.fetch(1)); - int month = int.parse(match_info.fetch(2)); - int day = int.parse(match_info.fetch(3)); - int hour = int.parse(match_info.fetch(4)); - int minute = int.parse(match_info.fetch(5)); - int second = int.parse(match_info.fetch(6)); - DateTime datetime = new DateTime.utc(year, month, day, hour, minute, second); - if (match_info.fetch(9) != "Z") { - char plusminus = match_info.fetch(11)[0]; - int tz_hour = int.parse(match_info.fetch(12)); - int tz_minute = int.parse(match_info.fetch(13)); - if (plusminus == '-') { - tz_hour *= -1; - tz_minute *= -1; - } - datetime.add_hours(tz_hour); - datetime.add_minutes(tz_minute); - } - return datetime; - } - return null; - } - - public string to_datetime(DateTime time) { - return time.format("%Y-%m-%dT%H:%M:%SZ"); - } -} - -}
\ No newline at end of file |