mirror of
https://github.com/deavminet/dnetd
synced 2024-09-21 17:53:39 +02:00
Added isProperty(string)
method
This commit is contained in:
parent
94f8922b4f
commit
d0dbb51eef
@ -681,7 +681,24 @@ public class DConnection : Thread
|
|||||||
/* If `get_user_prop` (requires: authed, client) */
|
/* If `get_user_prop` (requires: authed, client) */
|
||||||
else if(command == Command.GET_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
|
else if(command == Command.GET_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
|
||||||
{
|
{
|
||||||
|
/* Get the proerty */
|
||||||
|
string propertyName = cast(string)message.data[1..message.data.length];
|
||||||
|
|
||||||
|
/* Determine if it is a valid property */
|
||||||
|
bool status = isProperty(propertyName);
|
||||||
|
|
||||||
|
/* Encode the status */
|
||||||
|
reply ~= [status];
|
||||||
|
|
||||||
|
/* Encode the property value if one exists */
|
||||||
|
if(status)
|
||||||
|
{
|
||||||
|
/* Get the property value */
|
||||||
|
string propertyValue = getProperty(propertyName);
|
||||||
|
|
||||||
|
/* Encode the property value */
|
||||||
|
reply ~= propertyValue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* If `set_user_prop` (requires: authed, client) */
|
/* If `set_user_prop` (requires: authed, client) */
|
||||||
else if(command == Command.GET_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
|
else if(command == Command.GET_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
|
||||||
@ -856,6 +873,15 @@ public class DConnection : Thread
|
|||||||
properties[propertyName] = propertyValue;
|
properties[propertyName] = propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether or not the given property
|
||||||
|
* exists
|
||||||
|
*/
|
||||||
|
public bool isProperty(string propertyName)
|
||||||
|
{
|
||||||
|
return cast(bool)(propertyName in properties);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a property
|
* Returns a property
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user