irckitten 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +18 -0
- data/lib/irckitten.rb +14 -1
- metadata +1 -1
data/.gitignore
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/README.md
CHANGED
@@ -1,2 +1,20 @@
|
|
1
1
|
Ruby gem to do IRCCat based on SRV records. No longer do you have to
|
2
2
|
configure shit, that's what DNS is for.
|
3
|
+
|
4
|
+
|
5
|
+
So in your code, just do this:
|
6
|
+
<pre>
|
7
|
+
require 'irckitten'
|
8
|
+
|
9
|
+
IrcKitten::msg 'Thing broke... that is bad.'
|
10
|
+
</pre>
|
11
|
+
|
12
|
+
And it will look up your IRCCat server, via
|
13
|
+
'_irccat._tcp.yourdomain.example.org.' (and port), and try and send the
|
14
|
+
message to there.
|
15
|
+
|
16
|
+
Kind of ignores DNS search order and just chops chunks off your hostname
|
17
|
+
and searches there.
|
18
|
+
|
19
|
+
On 1.8.7 will try and use system_timer to do network timeouts. If it isn't
|
20
|
+
there, or you're on 1.9, then it just uses timeout.
|
data/lib/irckitten.rb
CHANGED
@@ -46,8 +46,21 @@ module IrcKitten
|
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
+
def self.getmyhostname
|
50
|
+
hostname = Socket.gethostname
|
51
|
+
|
52
|
+
if hostname.count( '.' ) < 1
|
53
|
+
hostname = Socket.gethostbyname( Socket.gethostname ).first
|
54
|
+
end
|
55
|
+
|
56
|
+
# if we can't get it, return false and bail.
|
57
|
+
return false if hostname.count( '.' ) < 1
|
58
|
+
|
59
|
+
hostname
|
60
|
+
end
|
61
|
+
|
49
62
|
def self.givemedomains
|
50
|
-
@myhostname ||=
|
63
|
+
@myhostname ||= self.getmyhostname
|
51
64
|
currentdomain = @myhostname
|
52
65
|
|
53
66
|
domain = []
|