mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
Fix merge & relative path for portable build
This commit is contained in:
commit
4125d690fa
33 changed files with 1556 additions and 581 deletions
|
|
@ -106,6 +106,7 @@ SET(PROTO_FILES
|
|||
event_user_joined.proto
|
||||
event_user_left.proto
|
||||
event_user_message.proto
|
||||
event_notify_user.proto
|
||||
game_commands.proto
|
||||
game_event_container.proto
|
||||
game_event_context.proto
|
||||
|
|
@ -127,6 +128,7 @@ SET(PROTO_FILES
|
|||
response_register.proto
|
||||
response_replay_download.proto
|
||||
response_replay_list.proto
|
||||
response_adjust_mod.proto
|
||||
response.proto
|
||||
room_commands.proto
|
||||
room_event.proto
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ message AdminCommand {
|
|||
UPDATE_SERVER_MESSAGE = 1000;
|
||||
SHUTDOWN_SERVER = 1001;
|
||||
RELOAD_CONFIG = 1002;
|
||||
ADJUST_MOD = 1003;
|
||||
}
|
||||
extensions 100 to max;
|
||||
}
|
||||
|
|
@ -26,3 +27,12 @@ message Command_ReloadConfig {
|
|||
optional Command_ReloadConfig ext = 1002;
|
||||
}
|
||||
}
|
||||
|
||||
message Command_AdjustMod {
|
||||
extend AdminCommand {
|
||||
optional Command_AdjustMod ext = 1003;
|
||||
}
|
||||
required string user_name = 1;
|
||||
required bool should_be_mod = 2;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ message Event_ConnectionClosed {
|
|||
BANNED = 4;
|
||||
USERNAMEINVALID = 5;
|
||||
USER_LIMIT_REACHED = 6;
|
||||
DEMOTED = 7;
|
||||
LOGGEDINELSEWERE = 8;
|
||||
}
|
||||
optional CloseReason reason = 1;
|
||||
optional string reason_str = 2;
|
||||
|
|
|
|||
14
common/pb/event_notify_user.proto
Normal file
14
common/pb/event_notify_user.proto
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import "session_event.proto";
|
||||
|
||||
message Event_NotifyUser {
|
||||
|
||||
enum NotificationType {
|
||||
PROMOTED = 1;
|
||||
}
|
||||
|
||||
extend SessionEvent {
|
||||
optional Event_NotifyUser ext = 1010;
|
||||
}
|
||||
optional NotificationType type = 1;
|
||||
|
||||
}
|
||||
|
|
@ -49,6 +49,7 @@ message Response {
|
|||
DECK_UPLOAD = 1008;
|
||||
REGISTER = 1009;
|
||||
ACTIVATE = 1010;
|
||||
ADJUST_MOD = 1011;
|
||||
REPLAY_LIST = 1100;
|
||||
REPLAY_DOWNLOAD = 1101;
|
||||
}
|
||||
|
|
|
|||
7
common/pb/response_adjust_mod.proto
Normal file
7
common/pb/response_adjust_mod.proto
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import "response.proto";
|
||||
|
||||
message Response_AdjustMod{
|
||||
extend Response {
|
||||
optional Response_AdjustMod ext = 1011;
|
||||
}
|
||||
}
|
||||
|
|
@ -44,6 +44,7 @@ message Command_Login {
|
|||
optional string user_name = 1;
|
||||
optional string password = 2;
|
||||
optional string clientid = 3;
|
||||
optional string clientver = 4;
|
||||
}
|
||||
|
||||
message Command_Message {
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ message SessionEvent {
|
|||
USER_JOINED = 1007;
|
||||
USER_LEFT = 1008;
|
||||
GAME_JOINED = 1009;
|
||||
NOTIFY_USER = 1010;
|
||||
REPLAY_ADDED = 1100;
|
||||
}
|
||||
extensions 100 to max;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "pb/event_user_left.pb.h"
|
||||
#include "pb/event_list_rooms.pb.h"
|
||||
#include "pb/session_event.pb.h"
|
||||
#include "pb/event_connection_closed.pb.h"
|
||||
#include "pb/isl_message.pb.h"
|
||||
#include <QCoreApplication>
|
||||
#include <QThread>
|
||||
|
|
@ -126,9 +127,17 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
|
|||
|
||||
// verify that new session would not cause problems with older existing session
|
||||
if (users.contains(name) || databaseInterface->userSessionExists(name)) {
|
||||
qDebug("Login denied: would overwrite old session");
|
||||
databaseInterface->unlockSessionTables();
|
||||
return WouldOverwriteOldSession;
|
||||
qDebug("Session already logged in, logging old session out");
|
||||
|
||||
Event_ConnectionClosed event;
|
||||
event.set_reason(Event_ConnectionClosed::LOGGEDINELSEWERE);
|
||||
event.set_reason_str("You have been logged out due to logging in at another location.");
|
||||
event.set_end_time(QDateTime::currentDateTime().toTime_t());
|
||||
|
||||
SessionEvent *se = users.value(name)->prepareSessionEvent(event);
|
||||
users.value(name)->sendProtocolItem(*se);
|
||||
delete se;
|
||||
|
||||
}
|
||||
} else if (authState == UnknownUser) {
|
||||
// Change user name so that no two users have the same names,
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public:
|
|||
void removeClient(Server_ProtocolHandler *player);
|
||||
virtual QString getLoginMessage() const { return QString(); }
|
||||
|
||||
virtual bool permitUnregisteredUsers() const { return true; }
|
||||
virtual bool getGameShouldPing() const { return false; }
|
||||
virtual bool getClientIdRequired() const { return false; }
|
||||
virtual bool getRegOnlyServer() const { return false; }
|
||||
|
|
|
|||
|
|
@ -652,7 +652,9 @@ Response::ResponseCode Server_ProtocolHandler::cmdCreateGame(const Command_Creat
|
|||
if (description.size() > 60)
|
||||
description = description.left(60);
|
||||
|
||||
Server_Game *game = new Server_Game(copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), cmd.max_players(), gameTypes, cmd.only_buddies(), cmd.only_registered(), cmd.spectators_allowed(), cmd.spectators_need_password(), cmd.spectators_can_talk(), cmd.spectators_see_everything(), room);
|
||||
// When server doesn't permit registered users to exist, do not honor only-reg setting
|
||||
bool onlyRegisteredUsers = cmd.only_registered() && (server->permitUnregisteredUsers());
|
||||
Server_Game *game = new Server_Game(copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), cmd.max_players(), gameTypes, cmd.only_buddies(), onlyRegisteredUsers, cmd.spectators_allowed(), cmd.spectators_need_password(), cmd.spectators_can_talk(), cmd.spectators_see_everything(), room);
|
||||
game->addPlayer(this, rc, false, false);
|
||||
room->addGame(game);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue