Consider game id in chat bot. Preparing new chat bot action: Mute player in game.

This commit is contained in:
lotodore
2012-01-07 09:31:28 +00:00
parent ec8ad3b6ab
commit 79fa9df3c9
11 changed files with 74 additions and 65 deletions
+19 -19
View File
@@ -1,21 +1,20 @@
--**************************************************************************
-- Copyright (C) 2009-2011 by Lothar May *
-- *
-- This program is free software; you can redistribute it and/or modify *
-- it under the terms of the GNU General Public License as published by *
-- the Free Software Foundation; either version 2 of the License, or *
-- (at your option) any later version. *
-- *
-- This program is distributed in the hope that it will be useful, *
-- but WITHOUT ANY WARRANTY; without even the implied warranty of *
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-- GNU General Public License for more details. *
-- *
-- You should have received a copy of the GNU General Public License *
-- along with this program; if not, write to the *
-- Free Software Foundation, Inc., *
-- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
--**************************************************************************
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
CHATCLEANER-PROTOCOL DEFINITIONS
IMPLICIT TAGS
@@ -68,7 +67,8 @@ CleanerChatReplyMessage ::= [APPLICATION 3] SEQUENCE {
cleanerActionNone (0),
cleanerActionWarning (1),
cleanerActionKick (2),
cleanerActionBan (3)
cleanerActionBan (3),
cleanerActionMute (4)
},
cleanerText UTF8String (SIZE(1..128)) OPTIONAL
}
+17 -18
View File
@@ -1,21 +1,20 @@
--**************************************************************************
-- Copyright (C) 2009-2011 by Lothar May *
-- *
-- This program is free software; you can redistribute it and/or modify *
-- it under the terms of the GNU General Public License as published by *
-- the Free Software Foundation; either version 2 of the License, or *
-- (at your option) any later version. *
-- *
-- This program is distributed in the hope that it will be useful, *
-- but WITHOUT ANY WARRANTY; without even the implied warranty of *
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-- GNU General Public License for more details. *
-- *
-- You should have received a copy of the GNU General Public License *
-- along with this program; if not, write to the *
-- Free Software Foundation, Inc., *
-- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
--**************************************************************************
/*****************************************************************************
* PokerTH - The open source texas holdem engine *
* Copyright (C) 2006-2011 Felix Hammer, Florian Thauer, Lothar May *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
POKERTH-PROTOCOL DEFINITIONS
IMPLICIT TAGS
+9 -2
View File
@@ -129,6 +129,11 @@ bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg)
string((const char *)netRequest->playerName.buf, netRequest->playerName.size).c_str()));
QString message(QString::fromUtf8(
string((const char *)netRequest->chatMessage.buf, netRequest->chatMessage.size).c_str()));
unsigned gameId = 0;
if (netRequest->cleanerChatType.present == CleanerChatType_PR_cleanerChatTypeGame) {
gameId = netRequest->cleanerChatType.choice.cleanerChatTypeGame.gameId;
}
// TODO use gameId
QStringList checkreturn = myMessageFilter->check(playerId, nick, message);
QString checkAction = checkreturn.at(0);
QString checkMessage = checkreturn.at(1);
@@ -143,10 +148,12 @@ bool CleanerServer::handleMessage(InternalChatCleanerPacket &msg)
if(checkAction == "warn") {
netReply->cleanerActionType = cleanerActionType_cleanerActionWarning;
} else if(checkAction == "kick") {
} else if (checkAction == "kick") {
netReply->cleanerActionType = cleanerActionType_cleanerActionKick;
} else if(checkAction == "kickban") {
} else if (checkAction == "kickban") {
netReply->cleanerActionType = cleanerActionType_cleanerActionBan;
} else if (checkAction == "mute") {
netReply->cleanerActionType = cleanerActionType_cleanerActionMute;
}
string tmpCheck(checkMessage.toUtf8());
+4 -4
View File
@@ -46,10 +46,10 @@ static asn_TYPE_member_t asn_MBR_ChatCleanerMessage_1[] = {
},
};
static asn_TYPE_tag2member_t asn_MAP_ChatCleanerMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_APPLICATION | (0 << 2)), 0, 0, 0 }, /* cleanerInitMessage at 27 */
{ (ASN_TAG_CLASS_APPLICATION | (1 << 2)), 1, 0, 0 }, /* cleanerInitAckMessage at 28 */
{ (ASN_TAG_CLASS_APPLICATION | (2 << 2)), 2, 0, 0 }, /* cleanerChatRequestMessage at 29 */
{ (ASN_TAG_CLASS_APPLICATION | (3 << 2)), 3, 0, 0 } /* cleanerChatReplyMessage at 31 */
{ (ASN_TAG_CLASS_APPLICATION | (0 << 2)), 0, 0, 0 }, /* cleanerInitMessage at 26 */
{ (ASN_TAG_CLASS_APPLICATION | (1 << 2)), 1, 0, 0 }, /* cleanerInitAckMessage at 27 */
{ (ASN_TAG_CLASS_APPLICATION | (2 << 2)), 2, 0, 0 }, /* cleanerChatRequestMessage at 28 */
{ (ASN_TAG_CLASS_APPLICATION | (3 << 2)), 3, 0, 0 } /* cleanerChatReplyMessage at 30 */
};
static asn_CHOICE_specifics_t asn_SPC_ChatCleanerMessage_specs_1 = {
sizeof(struct ChatCleanerMessage),
+9 -7
View File
@@ -410,18 +410,20 @@ static asn_INTEGER_enum_map_t asn_MAP_cleanerActionType_value2enum_5[] = {
{ 0, 17, "cleanerActionNone" },
{ 1, 20, "cleanerActionWarning" },
{ 2, 17, "cleanerActionKick" },
{ 3, 16, "cleanerActionBan" }
{ 3, 16, "cleanerActionBan" },
{ 4, 17, "cleanerActionMute" }
};
static unsigned int asn_MAP_cleanerActionType_enum2value_5[] = {
3, /* cleanerActionBan(3) */
2, /* cleanerActionKick(2) */
4, /* cleanerActionMute(4) */
0, /* cleanerActionNone(0) */
1 /* cleanerActionWarning(1) */
};
static asn_INTEGER_specifics_t asn_SPC_cleanerActionType_specs_5 = {
asn_MAP_cleanerActionType_value2enum_5, /* "tag" => N; sorted by tag */
asn_MAP_cleanerActionType_enum2value_5, /* N => "tag"; sorted by N */
4, /* Number of elements in the maps */
5, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1, /* Strict enumeration */
0, /* Native long size */
@@ -506,12 +508,12 @@ static ber_tlv_tag_t asn_DEF_CleanerChatReplyMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_CleanerChatReplyMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* requestId at 64 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 0 }, /* playerId at 66 */
{ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, 0, 0 }, /* cleanerActionType at 68 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* requestId at 63 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 0 }, /* playerId at 65 */
{ (ASN_TAG_CLASS_UNIVERSAL | (10 << 2)), 3, 0, 0 }, /* cleanerActionType at 67 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 4, 0, 0 }, /* cleanerText at 73 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* cleanerChatTypeLobby at 44 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 46 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* cleanerChatTypeLobby at 43 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 45 */
};
static asn_SEQUENCE_specifics_t asn_SPC_CleanerChatReplyMessage_specs_1 = {
sizeof(struct CleanerChatReplyMessage),
+3 -2
View File
@@ -27,9 +27,10 @@ extern "C" {
cleanerActionType_cleanerActionNone = 0,
cleanerActionType_cleanerActionWarning = 1,
cleanerActionType_cleanerActionKick = 2,
cleanerActionType_cleanerActionBan = 3
cleanerActionType_cleanerActionBan = 3,
cleanerActionType_cleanerActionMute = 4
}
e_cleanerActionType;
e_cleanerActionType;
/* CleanerChatReplyMessage */
typedef struct CleanerChatReplyMessage {
+6 -6
View File
@@ -417,12 +417,12 @@ static ber_tlv_tag_t asn_DEF_CleanerChatRequestMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_CleanerChatRequestMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* requestId at 56 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 0 }, /* playerId at 58 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 3, 0, 1 }, /* playerName at 59 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 4, -1, 0 }, /* chatMessage at 60 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* cleanerChatTypeLobby at 44 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 46 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 1 }, /* requestId at 55 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 2, -1, 0 }, /* playerId at 57 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 3, 0, 1 }, /* playerName at 58 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 4, -1, 0 }, /* chatMessage at 59 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 1, 0, 0 }, /* cleanerChatTypeLobby at 43 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 45 */
};
static asn_SEQUENCE_specifics_t asn_SPC_CleanerChatRequestMessage_specs_1 = {
sizeof(struct CleanerChatRequestMessage),
+2 -2
View File
@@ -28,8 +28,8 @@ static asn_TYPE_member_t asn_MBR_CleanerChatType_1[] = {
},
};
static asn_TYPE_tag2member_t asn_MAP_CleanerChatType_tag2el_1[] = {
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cleanerChatTypeLobby at 44 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 46 */
{ (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* cleanerChatTypeLobby at 43 */
{ (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* cleanerChatTypeGame at 45 */
};
static asn_CHOICE_specifics_t asn_SPC_CleanerChatType_specs_1 = {
sizeof(struct CleanerChatType),
+1 -1
View File
@@ -169,7 +169,7 @@ static ber_tlv_tag_t asn_DEF_CleanerChatTypeGame_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_CleanerChatTypeGame_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* gameId at 52 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 } /* gameId at 51 */
};
static asn_SEQUENCE_specifics_t asn_SPC_CleanerChatTypeGame_specs_1 = {
sizeof(struct CleanerChatTypeGame),
+2 -2
View File
@@ -89,8 +89,8 @@ static ber_tlv_tag_t asn_DEF_CleanerInitAckMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_CleanerInitAckMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* serverVersion at 39 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* serverSecret at 40 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* serverVersion at 38 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* serverSecret at 39 */
};
static asn_SEQUENCE_specifics_t asn_SPC_CleanerInitAckMessage_specs_1 = {
sizeof(struct CleanerInitAckMessage),
+2 -2
View File
@@ -89,8 +89,8 @@ static ber_tlv_tag_t asn_DEF_CleanerInitMessage_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (16 << 2))
};
static asn_TYPE_tag2member_t asn_MAP_CleanerInitMessage_tag2el_1[] = {
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* requestedVersion at 34 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* clientSecret at 35 */
{ (ASN_TAG_CLASS_UNIVERSAL | (2 << 2)), 0, 0, 0 }, /* requestedVersion at 33 */
{ (ASN_TAG_CLASS_UNIVERSAL | (12 << 2)), 1, 0, 0 } /* clientSecret at 34 */
};
static asn_SEQUENCE_specifics_t asn_SPC_CleanerInitMessage_specs_1 = {
sizeof(struct CleanerInitMessage),