-
-
Save mojombo/3992 to your computer and use it in GitHub Desktop.
Revisions
-
mojombo revised this gist
Aug 4, 2008 . 2 changed files with 0 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +0,0 @@ -
mojombo revised this gist
Aug 4, 2008 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,12 @@ module Jabber def self.read size = $stdin.read(2).unpack("n").first $stdin.read(size).split(':') end def self.write(success) answer = success ? 1 : 0 token = [2, answer].pack("nn") $stdout.write(token) $stdout.flush end -
vanpelt revised this gist
Aug 4, 2008 . 1 changed file with 36 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ module Jabber def self.read size = $stdin.read(2).unpack(">h") $stdin.read(size).split(':') end def self.write(success) answer = success ? 1 : 0 token = "2#{answer}".pack(">hh") $stdout.write(token) $stdout.flush end def self.auth(uname, server, pass) uname == "vanpelt" end def self.isuser(uname, server) uname == "vanpelt" end def self.setpass(uname, server, pass) false end end while true do data = Jabber.read success = case data[0] when "auth": Jabber.auth(*data[1,3]) when "isuser": Jabber.isuser(*data[1,2]) when "setpass": Jabber.setpass(*data[1,3]) else false end Jabber.write(success) end -
There are no files selected for viewing
File renamed without changes.This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ def self.read size = $stdin.read(2).unpack(">h") $stdin.read(size).split(':') end def self.write(success) answer = success ? 1 : 0 token = "2#{answer}".pack(">hh") $stdout.write(token) $stdout.flush end -
There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ def from_ejabberd(): input_length = sys.stdin.read(2) (size,) = unpack('>h', input_length) return sys.stdin.read(size).split(':') def to_ejabberd(bool): answer = 0 if bool: answer = 1 token = pack('>hh', 2, answer) sys.stdout.write(token) sys.stdout.flush()