MessageKind.kt (1452B)
1 /* 2 This file is part of GNUnet. 3 Copyright (C) 2021--2025 GNUnet e.V. 4 5 GNUnet is free software: you can redistribute it and/or modify it 6 under the terms of the GNU Affero General Public License as published 7 by the Free Software Foundation, either version 3 of the License, 8 or (at your option) any later version. 9 10 GNUnet is distributed in the hope that it will be useful, but 11 WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Affero General Public License for more details. 14 15 You should have received a copy of the GNU Affero General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 SPDX-License-Identifier: AGPL3.0-or-later 19 */ 20 /* 21 * @author t3sserakt 22 * @file GNUnetMessenger/app/src/main/java/org/gnunet/gnunetmessenger/model/MessageKind.kt 23 */ 24 25 package org.gnunet.gnunetmessenger.model 26 27 enum class MessageKind(val code: Int) { 28 UNKOWN (code = 0),WARNING(1), REFRESH(2), LOGIN(3), LOGOUT(4), 29 CREATED_ACCOUNT(5), DELETE_ACCOUNT(code = 6), UPDATE_ACCOUNT(7), 30 UPDATE_CONTEXT(8), JOIN(9), LEAVE(10), 31 CONTACT(11), 32 INVITATION(12), TEXT(13), FILE(14), 33 DELETION(15), TAG(16), ATTRIBUTES(17), SHARED_ATTRIBUTES(18), 34 DISCOURSE(19), DATA(20); 35 36 companion object { 37 fun fromCode(code: Int): MessageKind = 38 entries.firstOrNull { it.code == code } ?: WARNING 39 } 40 }