PtokaX forum

PtokaX => Support => Topic started by: rellik on 17 October, 2008, 01:23:47

Title: DC Tag
Post by: rellik on 17 October, 2008, 01:23:47
Hi There
Is there a way to dissalow certain dc clients? I have edited the ClientTags.xml with only 1 client's tag. It doesnt seem to affect which clients are allowed to connect to my hub. We have written a custom DC client with its own DC tag and i only want that client to connect to our hub.
Title: Re: DC Tag
Post by: Scanning on 17 October, 2008, 09:35:51
remember to have hub off when editing xml
UnTick the "accept tag from unknown client's"
<Bool Name="AcceptUnknownTag">0</Bool><!-- 0 to NOT Accept tag from unknown clients. -->
or use a script, remember to have hub off when editing xml
Title: Re: DC Tag
Post by: rellik on 17 October, 2008, 13:12:57
The Hub was completely closed. I have only 2 DC tags in my clienttags.xml file. Still all clients seem to be able to connect. Have checked that "accept tag from unknown client" is not ticked. Any other ideas why this wont work?
Title: Re: DC Tag
Post by: rellik on 17 October, 2008, 13:23:36
Quote from: Scanning on 17 October, 2008, 09:35:51

<Bool Name="AcceptUnknownTag">0</Bool><!-- 0 to NOT Accept tag from unknown clients. -->


I checked taht setting as well, its in the settings.xml. I am not running any bots at the moment, so it must be a ptokax setting that could override that?
Title: Re: DC Tag
Post by: Snooze on 17 October, 2008, 14:21:52
Untested:


tCfg = {
Client = ""   --Enter Client. Ex. DC++
Version = ""  --Enter Client Version. Ex. 0.670
Msg = "Your client is not allowed in this hub." --Enter Message to be sent when client is not allowed.
}
MyINFOArrival = function(user,data)
if Core.GetUserValue(user,6) and Core.GetUserValue(user,7) then
if not (Core.GetUserValue(user,6) == tCfg.Client and Core.GetUserValue(user,7) == tCfg.Version) then
Core.SendToUser(user,"*** "..tCfg.msg)
Core.Disconnect(user)
end
else
Core.SendToUser(user,"*** "..tCfg.msg)
Core.Disconnect(user)
end
end


[Edit]
You might want to allow all clients in the PtokaX GUI to avoid conflicts and confusions.
[/Edit]
Title: Re: DC Tag
Post by: rellik on 18 October, 2008, 01:23:26
Hi
Thanks for the help.
I get Syntax C:\Ptokax\scripts\client.lua:3: '}' expected (to close '{' at line 1) near 'Version' error.
Title: Re: DC Tag
Post by: rellik on 19 October, 2008, 20:58:13
Sheesh, thanks very much, could be very usefull that.
Title: Re: DC Tag
Post by: phredop on 20 October, 2008, 20:24:36
This script is exactly what i was looking for!  thanks a lot Mutor!  I was wondering if there is a way to allow certain profiles to use different clients though.  So as an OP, you can use Apex or another admin oriented client.

Thanks a lot!
Title: Re: DC Tag
Post by: phredop on 20 October, 2008, 22:32:44
no thank you.  that looks like exactly what i wanted, Thanks a LOT Mutor!

Phred
Title: Re: DC Tag
Post by: ckdcello on 21 October, 2008, 17:56:25
I'm rather new to scripting in lua and I really like this particular script, for both learning and practical use, but I'm having some difficulty with the ApexDC++ identification.  In particular, this portion of the script doesn't work for me:

                --Apex
{"^ApexDC++$",
"1.1.0",
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true},
},

Specifically, I can't connect to the hub using ApexDC++ at all.  I am thinking that the name tag and/or version number is not being recognized correctly, but I can't find any difference between the script and the client.  Any help would be appreciated.
Title: Re: DC Tag
Post by: ckdcello on 22 October, 2008, 05:14:50
Thanks for the response, however, I've already figured out that part.  The difficulty I'm having is this: using the ApexDC++ 1.1.0 client, I am unable to connect to the hub.  I'm running the Client Check 1.0 LUA 5.11 [Strict][API 2] script, with the small modification I've already posted (that is, setting all possibilities to true).  From my perspective, it appears that the script is not properly comparing the actual client tag to the check string (or the actual client version tag to the check string, or perhaps both).  Therefore, my question is this: is it possible there is some minor correction needed for that portion of the code (perhaps a LUA logic error that I'm not seeing)?  Or is this script (as is) working perfectly for other Apex users and just presenting a problem for me due to some quirk?   
Title: Re: DC Tag
Post by: ckdcello on 22 October, 2008, 05:56:54
Thanks so much, it works perfectly now.  I bow to the master. 
Title: Re: DC Tag
Post by: reaper on 06 January, 2009, 19:48:15
Hi!
I use this script and I cant get this to work
I try whit my dc++ v 0.68 and I cant login to my hubb plz where shuld I change the client so I can login and denny other client ?
--DC++ 0.670 -> 0.699 & 0.707
      {"^D*C*%+%+$",
      {"^0%.6[7-9][0-9]$","0%.707"},
      {[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true},
      },
      --RSX++
      {"^RSX%+%+$",
      "1.00",
      {[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false},
      },
      --Apex
      {"^ApexDC%+%+$",
      "1.1.0",
      {[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false},
      },


Quote from: Mutor on 20 October, 2008, 22:14:41
As you wish, let me know if you need to break down
the versions of a specific client, per profile.

-- http://forum.ptokax.org/index.php?topic=8084.msg75404#msg75404
--[[
Client Check 1.0 LUA 5.11 [Strict][API 2]

By Mutor 10/20/08

Allow only certain clients in the hub
- Allow clients, per profile
- Allow certain versions of a client


]]


tCfg = {
--{"Tag","Version" or {"Version-A","Version-B","Version-C"},{Profile table}},
Clients = {
--DC++ 0.670 -> 0.699 & 0.707
{"^D*C*%+%+$",
{"^0%.6[7-9][0-9]$","0%.707"},
{[-1] = true,[0] = true,[1] = true,[2] = true,[3] = true},
},
--RSX++
{"^RSX%+%+$",
"1.00",
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false},
},
--Apex
{"^ApexDC%+%+$",
"1.1.0",
{[-1] = false,[0] = true,[1] = true,[2] = false,[3] = false},
},
},
-- Enter Message to be sent when client is not allowed.
Msg = "Your client is not allowed in this hub.",
--Allow all client in GUI, restrict only with script?
AnyTag = true,
}

OnStartup = function() if tCfg.AnyTag and not SetMan.GetBool(52) then SetMan.SetBool(52,true) end end

MyINFOArrival = function(user,data)
local c,v,i = Core.GetUserValue(user,6),Core.GetUserValue(user,7),user.iProfile
if c and v then
if not CheckClient(c,v,i) then
return Core.SendToUser(user,"*** "..tCfg.Msg:gsub("client","%1 ["..c.." "..v.."]")),Core.Disconnect(user),true
end
else
return Core.SendToUser(user,"*** "..tCfg.Msg),Core.Disconnect(user),true
end
end

CheckClient = function(c,v,i)
c,v = c:lower(),v:lower()
for a,b in ipairs(tCfg.Clients) do
if b[1]:lower() == c or c:find(b[1]:lower()) then
if b[3][i] then
if type(b[2]) == "string" then
if b[2]:lower() == v then return true end
elseif type(b[2]) == "table" then
for c,d in ipairs(b[2]) do
if d:lower() == v then return true end
if v:find(d) then return true end
end
end
else
return false
end
end
end
return false
end