Last active
September 13, 2016 20:10
-
-
Save freaktechnik/f9ba42c683551124540853eb8e749afc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This Source Code Form is subject to the terms of the Mozilla Public | |
* License, v. 2.0. If a copy of the MPL was not distributed with this | |
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
/* | |
* This implements server-timestamps for IRC. | |
* http://ircv3.net/specs/extensions/server-time-3.2.html | |
*/ | |
this.EXPORTED_SYMBOLS = ["capServerTime", "tagServerTime"]; | |
Cu.import("resource:///modules/ircHandlers.jsm"); | |
var tagServerTime = { | |
name: "server-time Tags", | |
priority: ircHandlers.DEFAULT_PRIORITY, | |
isEnabled: () => true, | |
commands: { | |
"time": function(aMsg) { | |
aMsg.message.time = Math.floor(Date.parse(aMsg.tagValue) / 1000); | |
} | |
} | |
}; | |
var capServerTime = { | |
name: "server-time CAP", | |
priority: ircHandlers.DEFAULT_PRIORITY, | |
isEnabled: () => true, | |
commands: { | |
"server-time": function(aMessage) { | |
if(aMessage.cap.subcommand == "LS") { | |
this.sendMessage("CAP", ["REQ", "server-time"]); | |
} | |
return true; | |
}, | |
"znc.in/server-time-iso": function(aMessage) { | |
if(aMessage.cap.subcommand == "LS") { | |
this.sendMessage("CAP", ["REQ", "znc.in/server-time-iso"]); | |
} | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment