Author Topic: DC Tag  (Read 5168 times)

0 Members and 1 Guest are viewing this topic.

Offline rellik

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
DC Tag
« 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.

PtokaX forum

DC Tag
« on: 17 October, 2008, 01:23:47 »

Offline Scanning

  • Member
  • ***
  • Posts: 36
  • Karma: +14/-0
Re: DC Tag
« Reply #1 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

Offline rellik

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: DC Tag
« Reply #2 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?

Offline rellik

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: DC Tag
« Reply #3 on: 17 October, 2008, 13:23:36 »

<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?

Offline Snooze

  • Scripter
  • Viking
  • ******
  • Posts: 606
  • Karma: +54/-3
    • DiXBoT Website
Re: DC Tag
« Reply #4 on: 17 October, 2008, 14:21:52 »
Untested:

Code: [Select]
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]
« Last Edit: 17 October, 2008, 16:54:29 by Snooze »

Offline rellik

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: DC Tag
« Reply #5 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.

Offline rellik

  • Junior Member
  • **
  • Posts: 15
  • Karma: +1/-0
Re: DC Tag
« Reply #6 on: 19 October, 2008, 20:58:13 »
Sheesh, thanks very much, could be very usefull that.

Offline phredop

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: DC Tag
« Reply #7 on: 20 October, 2008, 20:24:36 »
This script is exactly what i was looking for!  thanks a lot American Idiot!  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!

Offline phredop

  • Newbie
  • *
  • Posts: 9
  • Karma: +1/-0
Re: DC Tag
« Reply #8 on: 20 October, 2008, 22:32:44 »
no thank you.  that looks like exactly what i wanted, Thanks a LOT American Idiot!

Phred

Offline ckdcello

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: DC Tag
« Reply #9 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:
Code: [Select]
                --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.

Offline ckdcello

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: DC Tag
« Reply #10 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?   

Offline ckdcello

  • Newbie
  • *
  • Posts: 3
  • Karma: +0/-0
Re: DC Tag
« Reply #11 on: 22 October, 2008, 05:56:54 »
Thanks so much, it works perfectly now.  I bow to the master. 

Offline reaper

  • Junior Member
  • **
  • Posts: 14
  • Karma: +2/-2
Re: DC Tag
« Reply #12 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},
      },


As you wish, let me know if you need to break down
the versions of a specific client, per profile.
Code: [Select]
-- http://forum.ptokax.org/index.php?topic=8084.msg75404#msg75404
--[[
Client Check 1.0 LUA 5.11 [Strict][API 2]

By American Idiot 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

PtokaX forum

Re: DC Tag
« Reply #12 on: 06 January, 2009, 19:48:15 »