PtokaX forum

Development Section => Your Developing Problems => Topic started by: VidFamne on 06 July, 2004, 00:39:02

Title: $Quit
Post by: VidFamne on 06 July, 2004, 00:39:02
Is Ptokax really sending out a $Quit to everyone, when a user disconnect?
And can this be captured by the DataArrival?
Or is it in UserDisconnected?
Title:
Post by: Corayzon on 06 July, 2004, 01:52:14
VidFamne,

$Quit works like so, ...

When a user sends $Quit to the server, the server sends the same unedited msg to all the users and then disconnects the socket.

This is so the clients can remove the user from their list.

Also when a client disconnects by themselfs, then the server if also forced to send the $Quit message to the hub again.

This can be handled in dataarrival. And i think the userdisconnect is executed after the server sends the quit message out to the hub.
if strsub(sData, 1, 5) == "$Quit" then
-- :: $Quit |
local _,_, sUsername = strfind(sData, "%$Quit (.*)|")
tUser:SendData("Quit -> sUsername: " .. sUsername)
end
more info bout handling hub commands can be found here (http://board.univ-angers.fr/thread.php?threadid=2105&boardid=4&styleid=1&sid=22bff80b3f9d3b1a309a03e3016ba8fb) and info about the p2p protocol can be found here (http://wza.digitalbrains.com/DC/doc/)

noza
Title:
Post by: Herodes on 06 July, 2004, 01:59:51
First Part :
--- Yes it does ... even if u have problems with it u can use this script NotRambitWombat (http://board.univ-angers.fr/thread.php?threadid=2091&boardid=12) has made,
 although since u don't describe any particular case I don't really know ... :)

Second Part :
--- Yes it can ... :D
function DataArrival(user, data)
if strsub(data, 1, 5) == "$Quit" then
--- TODO whatever code
end
end

Third Part :
--- I suppose the PtokaX inbuilt UserDisconnected/OpDisconnected functions,
are triggered on receiving a $Quit ....

Smile everything is possible :D:D:D
Title:
Post by: Herodes on 06 July, 2004, 02:01:07
Lolololololol I didn't know that browsing the forums with a 56K could have such an impact :D:D:D:D

Came second again .. :D
Title:
Post by: Corayzon on 06 July, 2004, 02:17:08
hehe Herodes, ...

good old cable bets the dialup once again

lolz
Title:
Post by: VidFamne on 06 July, 2004, 02:37:36
Thanks for the information :)
I just want to capture when a user disconnect for a counter I'm
working on.(Top 10)
I've tried with the UserDisconnect, but it seems it fails sometimes.
Btw, it looks like the client dont send any $Quit only the hub, according to the link you gave me. Dunno for sure.
Title:
Post by: Herodes on 06 July, 2004, 02:55:40
True that the Op/UserDisconnected and Op/NewUserConnected fail for some specific stuf ... I don't know why that is though ... .

Could someone give us a hint here ?
Title:
Post by: VidFamne on 06 July, 2004, 06:01:55
Hmm, it seems to be impossible to catch any $Quit through DataArrival.
Ive been logging it for some time now and havn't catch a single $Quit. :(
Title:
Post by: nErBoS on 06 July, 2004, 16:11:12
Hi,

Try to put this in the main...

function Main()
frmHub:EnableFullData(1)
end

frmHub:EnableFullData(n) ... enables/disables passing of ALL incomming data to current script

1- for enable, 0 - for disable

Best regards, nErBoS
Title:
Post by: HaArD on 07 July, 2004, 07:17:55
QuoteOriginally posted by Corayzon
VidFamne,

$Quit works like so, ...

When a user sends $Quit to the server, the server sends the same unedited msg to all the users and then disconnects the socket.

This is so the clients can remove the user from their list.

Also when a client disconnects by themselfs, then the server if also forced to send the $Quit message to the hub again.
....snip...
noza

For the record, DC Clients do not send $Quit to the Hub.

The $Quit message is created by the Hub to advise other clients that a user is no longer connected to the hub regardless of the reason (Closed client, lost net connection, got kicked, got redirected or whatever)
Title:
Post by: Corayzon on 07 July, 2004, 07:31:24
VidFamne,
   
"Btw, it looks like the client dont send any $Quit only the hub, according to the link you gave me. Dunno for sure."
 
the client shouldnt send the $Quit string, it should just disconnect yes. But most hub soft will actually handle the $Quit string if it is directly sent by a user to disconnect to.

HaArD,

"For the record, DC Clients do not send $Quit to the Hub. "

i never said it does, i explained how the $Quit string is handled in multiple cases from the server.

And have u ever tried sending it to a ptokax server?

whahaha

noza