From: Eddie Date: Tue, 2 Jun 2015 15:58:42 +0000 (+0100) Subject: libs.message: new Message types X-Git-Url: https://iam.tj/gitweb/gitweb.cgi?p=WeStealzYourDataz.git;a=commitdiff_plain;h=90bf5cccac94c77561a478b5c994148f7a89e3b6 libs.message: new Message types --- diff --git a/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageLogin.java b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageLogin.java new file mode 100644 index 0000000..608bc89 --- /dev/null +++ b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageLogin.java @@ -0,0 +1,62 @@ +/* + * The MIT License + * + * Copyright 2015 eddie. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package uk.ac.ntu.n0521366.wsyd.libs.message; + +/** + * Message used to authenticate a login with the SocialServer. + * + * @author eddie + */ +public class MessageLogin extends MessageAbstract { + + private static final String _type = "Login"; + + public final String _uName; + + public final String _uPass; + + public long _userID = 0; + + public boolean _loggedIn = false; + + public static String getType() { + return _type; + } + + @Override + public String getMessageType() { + return _type; + } + + public MessageLogin() { + this._uName = null; + this._uPass = null; + } + + public MessageLogin (String uName, String uPass) { + this._uName = uName; + this._uPass = uPass; + } + +} diff --git a/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageMemberState.java b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageMemberState.java new file mode 100644 index 0000000..52dd4bd --- /dev/null +++ b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageMemberState.java @@ -0,0 +1,57 @@ +/* + * The MIT License + * + * Copyright 2015 eddie. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package uk.ac.ntu.n0521366.wsyd.libs.message; + +/** + * Message used to notify a member's state to other members. + * + * @author eddie + */ +public class MessageMemberState extends MessageAbstract { + + private static final String _type = "MemberState"; + + public long _userID; + + public boolean _onlineStatus; + + public static String getType() { + return _type; + } + + @Override + public String getMessageType() { + return _type; + } + + public MessageMemberState() { + this._userID = 0; + this._onlineStatus = false; + } + + public MessageMemberState(long userID, boolean state) { + this._userID = userID; + this._onlineStatus = state; + } +} diff --git a/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageNetworkStream.java b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageNetworkStream.java new file mode 100644 index 0000000..ff5f5ba --- /dev/null +++ b/src/uk/ac/ntu/n0521366/wsyd/libs/message/MessageNetworkStream.java @@ -0,0 +1,50 @@ +/* + * The MIT License + * + * Copyright 2015 eddie. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +package uk.ac.ntu.n0521366.wsyd.libs.message; + +import uk.ac.ntu.n0521366.wsyd.libs.net.NetworkStream; +/** + * Pass a NetworkStream reference in a message. + * + * @author eddie + */ +public class MessageNetworkStream extends MessageAbstract { + public static final String _type = "NetworkStream"; + + public final NetworkStream _stream; + + public static String getType() { + return _type; + } + + @Override + public String getMessageType() { + return _type; + } + + public MessageNetworkStream(NetworkStream stream) { + super(); + _stream = stream; + } +}