Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
1bee7882
Commit
1bee7882
authored
Mar 02, 2011
by
Max-Wilhelm Bruker
Browse files
don't pm people ignoring you
parent
0afdbc72
Changes
9
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/tab_message.cpp
View file @
1bee7882
...
...
@@ -45,10 +45,18 @@ void TabMessage::sendMessage()
if
(
sayEdit
->
text
().
isEmpty
()
||
!
userOnline
)
return
;
client
->
sendCommand
(
new
Command_Message
(
userName
,
sayEdit
->
text
()));
Command_Message
*
cmd
=
new
Command_Message
(
userName
,
sayEdit
->
text
());
connect
(
cmd
,
SIGNAL
(
finished
(
ProtocolResponse
*
)),
this
,
SLOT
(
messageSent
(
ProtocolResponse
*
)));
client
->
sendCommand
(
cmd
);
sayEdit
->
clear
();
}
void
TabMessage
::
messageSent
(
ProtocolResponse
*
response
)
{
if
(
response
->
getResponseCode
()
==
RespInIgnoreList
)
chatView
->
appendMessage
(
QString
(),
tr
(
"This user is ignoring you."
));
}
void
TabMessage
::
actLeave
()
{
deleteLater
();
...
...
cockatrice/src/tab_message.h
View file @
1bee7882
...
...
@@ -7,6 +7,7 @@ class AbstractClient;
class
ChatView
;
class
QLineEdit
;
class
Event_Message
;
class
ProtocolResponse
;
class
TabMessage
:
public
Tab
{
Q_OBJECT
...
...
@@ -24,6 +25,7 @@ signals:
private
slots
:
void
sendMessage
();
void
actLeave
();
void
messageSent
(
ProtocolResponse
*
response
);
public:
TabMessage
(
TabSupervisor
*
_tabSupervisor
,
AbstractClient
*
_client
,
const
QString
&
_ownName
,
const
QString
&
_userName
);
~
TabMessage
();
...
...
cockatrice/src/tab_room.cpp
View file @
1bee7882
...
...
@@ -80,7 +80,7 @@ void GameSelector::checkResponse(ResponseCode response)
case
RespNameNotFound
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"The game does not exist any more."
));
break
;
case
RespUserLevelTooLow
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This game is only open to registered users."
));
break
;
case
RespOnlyBuddies
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This game is only open to its creator's buddies."
));
break
;
case
Resp
O
nIgnoreList
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"You are being ignored by the creator of this game."
));
break
;
case
Resp
I
nIgnoreList
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"You are being ignored by the creator of this game."
));
break
;
default:
;
}
}
...
...
common/protocol.cpp
View file @
1bee7882
...
...
@@ -266,7 +266,7 @@ void ProtocolResponse::initializeHash()
responseHash
.
insert
(
"spectators_not_allowed"
,
RespSpectatorsNotAllowed
);
responseHash
.
insert
(
"only_buddies"
,
RespOnlyBuddies
);
responseHash
.
insert
(
"user_level_too_low"
,
RespUserLevelTooLow
);
responseHash
.
insert
(
"
o
n_ignore_list"
,
Resp
O
nIgnoreList
);
responseHash
.
insert
(
"
i
n_ignore_list"
,
Resp
I
nIgnoreList
);
}
Response_JoinRoom
::
Response_JoinRoom
(
int
_cmdId
,
ResponseCode
_responseCode
,
ServerInfo_Room
*
_roomInfo
)
...
...
common/protocol_datastructures.h
View file @
1bee7882
...
...
@@ -8,7 +8,7 @@
class
DeckList
;
enum
ResponseCode
{
RespNothing
,
RespOk
,
RespInternalError
,
RespInvalidCommand
,
RespInvalidData
,
RespNameNotFound
,
RespLoginNeeded
,
RespFunctionNotAllowed
,
RespGameNotStarted
,
RespGameFull
,
RespContextError
,
RespWrongPassword
,
RespSpectatorsNotAllowed
,
RespOnlyBuddies
,
RespUserLevelTooLow
,
Resp
O
nIgnoreList
};
enum
ResponseCode
{
RespNothing
,
RespOk
,
RespInternalError
,
RespInvalidCommand
,
RespInvalidData
,
RespNameNotFound
,
RespLoginNeeded
,
RespFunctionNotAllowed
,
RespGameNotStarted
,
RespGameFull
,
RespContextError
,
RespWrongPassword
,
RespSpectatorsNotAllowed
,
RespOnlyBuddies
,
RespUserLevelTooLow
,
Resp
I
nIgnoreList
};
// PrivateZone: Contents of the zone are always visible to the owner,
// but not to anyone else.
...
...
common/server_game.cpp
View file @
1bee7882
...
...
@@ -183,7 +183,7 @@ ResponseCode Server_Game::checkJoin(ServerInfo_User *user, const QString &_passw
if
(
!
static_cast
<
Server_Room
*>
(
parent
())
->
getServer
()
->
getBuddyList
(
creatorInfo
->
getName
()).
contains
(
user
->
getName
()))
return
RespOnlyBuddies
;
if
(
static_cast
<
Server_Room
*>
(
parent
())
->
getServer
()
->
getIgnoreList
(
creatorInfo
->
getName
()).
contains
(
user
->
getName
()))
return
Resp
O
nIgnoreList
;
return
Resp
I
nIgnoreList
;
if
(
spectator
)
{
if
(
!
spectatorsAllowed
)
return
RespSpectatorsNotAllowed
;
...
...
common/server_protocolhandler.cpp
View file @
1bee7882
...
...
@@ -281,6 +281,8 @@ ResponseCode Server_ProtocolHandler::cmdMessage(Command_Message *cmd, CommandCon
Server_ProtocolHandler
*
userHandler
=
server
->
getUsers
().
value
(
receiver
);
if
(
!
userHandler
)
return
RespNameNotFound
;
if
(
userHandler
->
getIgnoreList
().
contains
(
userInfo
->
getName
()))
return
RespInIgnoreList
;
cont
->
enqueueItem
(
new
Event_Message
(
userInfo
->
getName
(),
receiver
,
cmd
->
getText
()));
userHandler
->
sendProtocolItem
(
new
Event_Message
(
userInfo
->
getName
(),
receiver
,
cmd
->
getText
()));
...
...
servatrice/servatrice.sql
View file @
1bee7882
...
...
@@ -128,3 +128,16 @@ CREATE TABLE `cockatrice_servermessages` (
`message`
text
,
PRIMARY
KEY
(
`timest`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
CREATE
TABLE
`cockatrice_ignorelist`
(
`id_user1`
int
(
7
)
unsigned
NOT
NULL
,
`id_user2`
int
(
7
)
unsigned
NOT
NULL
,
UNIQUE
KEY
`key`
(
`id_user1`
,
`id_user2`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
CREATE
TABLE
`cockatrice_buddylist`
(
`id_user1`
int
(
7
)
unsigned
NOT
NULL
,
`id_user2`
int
(
7
)
unsigned
NOT
NULL
,
UNIQUE
KEY
`key`
(
`id_user1`
,
`id_user2`
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
utf8
;
servatrice/src/serversocketinterface.cpp
View file @
1bee7882
...
...
@@ -111,6 +111,9 @@ int ServerSocketInterface::getUserIdInDB(const QString &name) const
ResponseCode
ServerSocketInterface
::
cmdAddToList
(
Command_AddToList
*
cmd
,
CommandContainer
*
cont
)
{
if
(
authState
!=
PasswordRight
)
return
RespFunctionNotAllowed
;
QString
list
=
cmd
->
getList
();
QString
user
=
cmd
->
getUserName
();
...
...
@@ -148,6 +151,9 @@ ResponseCode ServerSocketInterface::cmdAddToList(Command_AddToList *cmd, Command
ResponseCode
ServerSocketInterface
::
cmdRemoveFromList
(
Command_RemoveFromList
*
cmd
,
CommandContainer
*
cont
)
{
if
(
authState
!=
PasswordRight
)
return
RespFunctionNotAllowed
;
QString
list
=
cmd
->
getList
();
QString
user
=
cmd
->
getUserName
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment