Merge with waqas

Sun, 27 Sep 2009 12:10:36 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 27 Sep 2009 12:10:36 +0100
changeset 1831
d5a1fd78a06a
parent 1825
48cb27e2716e (diff)
parent 1827
dc4d47d91d66 (current diff)
child 1832
5ae3209fefa2

Merge with waqas

--- a/core/s2smanager.lua	Tue Sep 22 22:31:41 2009 +0500
+++ b/core/s2smanager.lua	Sun Sep 27 12:10:36 2009 +0100
@@ -254,20 +254,20 @@
 		host_session.connecting = nil;
 		
 		-- COMPAT: This is a compromise for all you CNAME-(ab)users :)
-		if not (reply and reply[1] and reply[1].a) then
+		if not (reply and reply[#reply] and reply[#reply].a) then
 			local count = max_dns_depth;
 			reply = dns.peek(connect_host, "CNAME", "IN");
-			while count > 0 and reply and reply[1] and not reply[1].a and reply[1].cname do
-				log("debug", "Looking up %s (DNS depth is %d)", tostring(reply[1].cname), count);
-				reply = dns.peek(reply[1].cname, "A", "IN") or dns.peek(reply[1].cname, "CNAME", "IN");
+			while count > 0 and reply and reply[#reply] and not reply[#reply].a and reply[#reply].cname do
+				log("debug", "Looking up %s (DNS depth is %d)", tostring(reply[#reply].cname), count);
+				reply = dns.peek(reply[#reply].cname, "A", "IN") or dns.peek(reply[#reply].cname, "CNAME", "IN");
 				count = count - 1;
 			end
 		end
 		-- end of CNAME resolving
 		
-		if reply and reply[1] and reply[1].a then
-			log("debug", "DNS reply for %s gives us %s", connect_host, reply[1].a);
-			return make_connect(host_session, reply[1].a, connect_port);
+		if reply and reply[#reply] and reply[#reply].a then
+			log("debug", "DNS reply for %s gives us %s", connect_host, reply[#reply].a);
+			return make_connect(host_session, reply[#reply].a, connect_port);
 		else
 			log("debug", "DNS lookup failed to get a response for %s", connect_host);
 			if not attempt_connection(host_session, "name resolution failed") then -- Retry if we can
--- a/net/dns.lua	Tue Sep 22 22:31:41 2009 +0500
+++ b/net/dns.lua	Sun Sep 27 12:10:36 2009 +0100
@@ -95,7 +95,10 @@
     if rr.tod then
       -- rr.tod = rr.tod - 50    -- accelerated decripitude
       rr.ttl = math.floor (rr.tod - time)
-      if rr.ttl <= 0 then  rrs[i] = nil  end
+      if rr.ttl <= 0 then
+        table.remove(rrs, i);
+        return prune(rrs, time, soft); -- Re-iterate
+      end
 
     elseif soft == 'soft' then    -- What is this?  I forget!
       assert (rr.ttl == 0)
@@ -507,8 +510,8 @@
   local resolv_conf = io.open("/etc/resolv.conf");
   if resolv_conf then
 	  for line in resolv_conf:lines() do
-		local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)')
-		if address then  self:addnameserver (address)  end
+		local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$')
+		if address then self:addnameserver (address)  end
 	  end
   elseif os.getenv("WINDIR") then
   	self:addnameserver ("208.67.222.222")
--- a/plugins/mod_console.lua	Tue Sep 22 22:31:41 2009 +0500
+++ b/plugins/mod_console.lua	Sun Sep 27 12:10:36 2009 +0100
@@ -496,7 +496,7 @@
 		if not session then 
 			print("No outgoing connection from "..from.." to "..to)
 		else
-			s2smanager.destroy_session(session);
+			(session.close or s2smanager.destroy_session)(session);
 			count = count + 1;
 			print("Closed outgoing session from "..from.." to "..to);
 		end
@@ -504,7 +504,7 @@
 		-- Is an incoming connection
 		for session in pairs(incoming_s2s) do
 			if session.to_host == to and session.from_host == from then
-				s2smanager.destroy_session(session);
+				(session.close or s2smanager.destroy_session)(session);
 				count = count + 1;
 			end
 		end
--- a/plugins/mod_welcome.lua	Tue Sep 22 22:31:41 2009 +0500
+++ b/plugins/mod_welcome.lua	Sun Sep 27 12:10:36 2009 +0100
@@ -9,7 +9,7 @@
 local config = require "core.configmanager";
 
 local host = module:get_host();
-local welcome_text = config.get("*", "core", "welcome_message") or "Hello $user, welcome to the $host IM server!";
+local welcome_text = config.get("*", "core", "welcome_message") or "Hello $username, welcome to the $host IM server!";
 
 local st = require "util.stanza";
 

mercurial