From 64897c1ba0cf119fe19d2e1173b062c6ce4acc00 Mon Sep 17 00:00:00 2001 From: kizeren Date: Mon, 17 Dec 2012 00:00:13 -0600 Subject: [PATCH 1/8] Update src/init.lua --- src/init.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/init.lua b/src/init.lua index 32ca3dc..fadba37 100644 --- a/src/init.lua +++ b/src/init.lua @@ -214,6 +214,9 @@ minetest.register_chatcommand("join", { return; end mt_irc.connected_players[name] = true; +-- Best way I could get bot to autojoin channel was to add the irc.join function here. +-- Bot won't connect until the first user joins. The bot will not disconect if last player leaves. + irc.join(mt_irc.channel); minetest.chat_send_player(name, "IRC: You are now in the channel."); end; }); From 956b9cc7aa164fea0a88743c57e0f08827501803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 18 Dec 2012 02:50:53 -0200 Subject: [PATCH 2/8] Testing --- src/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/init.lua b/src/init.lua index 32ca3dc..3c3fdc9 100644 --- a/src/init.lua +++ b/src/init.lua @@ -174,7 +174,7 @@ minetest.register_chatcommand("msg", { local name = param:sub(1, pos - 1); local msg = param:sub(pos + 1); local t = { - name=nick; + name=name; message=msg; }; local text = mt_irc.message_format_out:gsub("%$%(([^)]+)%)", t) @@ -242,4 +242,8 @@ if (mt_irc.connect_on_load) then timeout = mt_irc.timeout; channel = mt_irc.channel; }); + if (not mt_irc.connect_ok) then + local s = "DEBUG: irc.connect failed"; + minetest.chat_send_all(s); + end end From 60506bb1950bf19b49a7020f3f9df7926e782b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 18 Dec 2012 03:03:44 -0200 Subject: [PATCH 3/8] Testing --- src/init.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/init.lua b/src/init.lua index 395a06c..ae56154 100644 --- a/src/init.lua +++ b/src/init.lua @@ -72,11 +72,9 @@ minetest.register_globalstep(function ( dtime ) irc.poll(); mt_irc.cur_time = mt_irc.cur_time - mt_irc.dtime; local plys = minetest.get_connected_players(); ---Source of flooding in these lines ---However, bot will not connect to a channel but can PM across minetest and IRC to users ust fine. --- if (#plys <= 0) then -- Just in case :) --- irc.quit("Closing."); --- end + if (#plys <= 0) then -- Just in case :) + irc.quit("Closing."); + end end end); @@ -85,6 +83,9 @@ minetest.register_on_joinplayer(function ( player ) irc.register_callback("connect", function ( ) irc.join(mt_irc.channel); irc.say(mt_irc.channel, "*** "..player:get_player_name().." joined the game"); + for _,player in ipairs(minetest.get_connected_players()) do + mt_irc.connected_players[player:get_player_name()] = mt_irc.connect_on_join; + end end); irc.register_callback("channel_msg", function ( channel, from, message ) @@ -134,14 +135,12 @@ minetest.register_on_joinplayer(function ( player ) if (not mt_irc.connect_ok) then return; end end); - mt_irc.connected_players[player:get_player_name()] = mt_irc.connect_on_join; - end); minetest.register_on_leaveplayer(function ( player ) - if (not mt_irc.connect_ok) then return; end local name = player:get_player_name(); mt_irc.connected_players[name] = false; + if (not mt_irc.connect_ok) then return; end irc.say(mt_irc.channel, "*** "..name.." left the game"); end); @@ -216,7 +215,7 @@ minetest.register_chatcommand("join", { mt_irc.connected_players[name] = true; -- Best way I could get bot to autojoin channel was to add the irc.join function here. -- Bot won't connect until the first user joins. The bot will not disconect if last player leaves. - irc.join(mt_irc.channel); + --irc.join(mt_irc.channel); minetest.chat_send_player(name, "IRC: You are now in the channel."); end; }); From 4cbb5b8ce70902be8889744684cdf9ce857ca2c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 18 Dec 2012 03:21:16 -0200 Subject: [PATCH 4/8] Testing --- src/init.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/init.lua b/src/init.lua index ae56154..3e65a4f 100644 --- a/src/init.lua +++ b/src/init.lua @@ -72,8 +72,10 @@ minetest.register_globalstep(function ( dtime ) irc.poll(); mt_irc.cur_time = mt_irc.cur_time - mt_irc.dtime; local plys = minetest.get_connected_players(); - if (#plys <= 0) then -- Just in case :) - irc.quit("Closing."); + if ((#plys <= 0) and (minetest.is_singleplayer())) then + minetest.after(1.0, function ( ) + irc.quit("Closing."); + end) end end end); From af47f58767168eef7b0fe016082ce39106178a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 18 Dec 2012 21:11:55 -0200 Subject: [PATCH 5/8] Minor changes to maintainer scripts --- etc/install.sh | 3 +++ etc/zipmod.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/install.sh b/etc/install.sh index 03fe6d9..f246261 100755 --- a/etc/install.sh +++ b/etc/install.sh @@ -9,3 +9,6 @@ rm -fr "$destdir"; echo cp -fr Build/irc "\"$destdir\""; cp -fr Build/irc "$destdir"; + +echo cp -f dists/* ~/Dropbox/Public/; +cp -f dists/* ~/Dropbox/Public/; diff --git a/etc/zipmod.sh b/etc/zipmod.sh index 71b9522..9b509ee 100755 --- a/etc/zipmod.sh +++ b/etc/zipmod.sh @@ -7,7 +7,7 @@ cd "`dirname "$0"`/.."; basedir="`pwd`"; cd "$t"; -ver=0.1.0; +ver=0.1.2; do_make() # [PLATFORM] { From a1957de7eed64682eda1f28ca10b80b91e803bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 18 Dec 2012 23:15:48 -0200 Subject: [PATCH 6/8] Testing --- src/init.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/init.lua b/src/init.lua index 3e65a4f..a12b736 100644 --- a/src/init.lua +++ b/src/init.lua @@ -71,15 +71,18 @@ minetest.register_globalstep(function ( dtime ) end irc.poll(); mt_irc.cur_time = mt_irc.cur_time - mt_irc.dtime; - local plys = minetest.get_connected_players(); - if ((#plys <= 0) and (minetest.is_singleplayer())) then - minetest.after(1.0, function ( ) - irc.quit("Closing."); - end) - end + --local plys = minetest.get_connected_players(); + --if ((#plys <= 0) and (minetest.is_singleplayer())) then + -- minetest.after(1.0, function ( ) + -- irc.quit("Closing."); + -- end) + --end end end); +local function do_connect ( ) +end + minetest.register_on_joinplayer(function ( player ) irc.register_callback("connect", function ( ) From 6e7447d7dd61db5f86e3e75bc94ca9284e06d091 Mon Sep 17 00:00:00 2001 From: kizeren Date: Tue, 18 Dec 2012 19:26:58 -0600 Subject: [PATCH 7/8] Update src/init.lua Removing autjoin stuff. Bot refuses to join regardless. Going to have bot join when any users types the in game "/join" command. For this to work autoconnect needs to enabled. --- src/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.lua b/src/init.lua index a12b736..77b6623 100644 --- a/src/init.lua +++ b/src/init.lua @@ -220,7 +220,7 @@ minetest.register_chatcommand("join", { mt_irc.connected_players[name] = true; -- Best way I could get bot to autojoin channel was to add the irc.join function here. -- Bot won't connect until the first user joins. The bot will not disconect if last player leaves. - --irc.join(mt_irc.channel); + irc.join(mt_irc.channel); minetest.chat_send_player(name, "IRC: You are now in the channel."); end; }); From 1d58683c7b0f4e5368ee48246a4ff8c04989ecb6 Mon Sep 17 00:00:00 2001 From: kizeren Date: Tue, 18 Dec 2012 19:28:07 -0600 Subject: [PATCH 8/8] Update src/config.lua Removing autjoin stuff. Bot refuses to join regardless. Going to have bot join when any users types the in game "/join" command. For this to work autoconnect needs to enabled. --- src/config.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.lua b/src/config.lua index dd9dc98..949629d 100644 --- a/src/config.lua +++ b/src/config.lua @@ -1,4 +1,3 @@ - -- ************************* -- ** BASIC USER SETTINGS ** -- ************************* @@ -41,7 +40,9 @@ mt_irc.message_format_in = "<$(name)@IRC> $(message)"; mt_irc.debug = true; -- Whether to automatically join the channed when player joins --- (boolean, default false) +-- (boolean, default false) +-- For now leave this false if using autoconnect. Bot will join channel when first user +-- types the /join command in game. mt_irc.connect_on_join = false; -- Whether to automatically connect to the server on mod load