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
f38c5f50
Commit
f38c5f50
authored
Aug 03, 2011
by
Max-Wilhelm Bruker
Browse files
server crash fix
parent
a569a1b8
Changes
3
Hide whitespace changes
Inline
Side-by-side
common/protocol_datastructures.h
View file @
f38c5f50
...
@@ -53,6 +53,7 @@ public:
...
@@ -53,6 +53,7 @@ public:
ServerInfo_User
(
const
ServerInfo_User
*
other
,
bool
complete
=
true
);
ServerInfo_User
(
const
ServerInfo_User
*
other
,
bool
complete
=
true
);
static
SerializableItem
*
newItem
()
{
return
new
ServerInfo_User
;
}
static
SerializableItem
*
newItem
()
{
return
new
ServerInfo_User
;
}
QString
getName
()
const
{
return
static_cast
<
SerializableItem_String
*>
(
itemMap
.
value
(
"name"
))
->
getData
();
}
QString
getName
()
const
{
return
static_cast
<
SerializableItem_String
*>
(
itemMap
.
value
(
"name"
))
->
getData
();
}
void
setName
(
const
QString
&
_name
)
{
static_cast
<
SerializableItem_String
*>
(
itemMap
.
value
(
"name"
))
->
setData
(
_name
);
}
int
getUserLevel
()
const
{
return
static_cast
<
SerializableItem_Int
*>
(
itemMap
.
value
(
"userlevel"
))
->
getData
();
}
int
getUserLevel
()
const
{
return
static_cast
<
SerializableItem_Int
*>
(
itemMap
.
value
(
"userlevel"
))
->
getData
();
}
void
setUserLevel
(
int
_userLevel
)
{
static_cast
<
SerializableItem_Int
*>
(
itemMap
.
value
(
"userlevel"
))
->
setData
(
_userLevel
);
}
void
setUserLevel
(
int
_userLevel
)
{
static_cast
<
SerializableItem_Int
*>
(
itemMap
.
value
(
"userlevel"
))
->
setData
(
_userLevel
);
}
QString
getRealName
()
const
{
return
static_cast
<
SerializableItem_String
*>
(
itemMap
.
value
(
"real_name"
))
->
getData
();
}
QString
getRealName
()
const
{
return
static_cast
<
SerializableItem_String
*>
(
itemMap
.
value
(
"real_name"
))
->
getData
();
}
...
...
common/server.cpp
View file @
f38c5f50
...
@@ -73,6 +73,7 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
...
@@ -73,6 +73,7 @@ AuthenticationResult Server::loginUser(Server_ProtocolHandler *session, QString
while
(
users
.
contains
(
tempName
)
||
userExists
(
tempName
))
while
(
users
.
contains
(
tempName
)
||
userExists
(
tempName
))
tempName
=
name
+
"_"
+
QString
::
number
(
++
i
);
tempName
=
name
+
"_"
+
QString
::
number
(
++
i
);
name
=
tempName
;
name
=
tempName
;
data
->
setName
(
name
);
}
}
session
->
setUserInfo
(
data
);
session
->
setUserInfo
(
data
);
...
...
servatrice/src/servatrice.cpp
View file @
f38c5f50
...
@@ -220,7 +220,7 @@ bool Servatrice::userExists(const QString &user)
...
@@ -220,7 +220,7 @@ bool Servatrice::userExists(const QString &user)
checkSql
();
checkSql
();
QSqlQuery
query
;
QSqlQuery
query
;
query
.
prepare
(
"select 1 from "
+
dbPrefix
+
"_users where name = :name"
);
query
.
prepare
(
"select 1 from "
+
dbPrefix
+
"_users where name = :name
and active = 1
"
);
query
.
bindValue
(
":name"
,
user
);
query
.
bindValue
(
":name"
,
user
);
if
(
!
execSqlQuery
(
query
))
if
(
!
execSqlQuery
(
query
))
return
false
;
return
false
;
...
@@ -423,4 +423,4 @@ void Servatrice::shutdownTimeout()
...
@@ -423,4 +423,4 @@ void Servatrice::shutdownTimeout()
deleteLater
();
deleteLater
();
}
}
const
QString
Servatrice
::
versionString
=
"Servatrice 0.20110
625
"
;
const
QString
Servatrice
::
versionString
=
"Servatrice 0.20110
803
"
;
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