Skip to content

Commit

Permalink
Fix recent whitespace regressions (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
slook authored Oct 6, 2024
1 parent 0599f03 commit 5863e49
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
11 changes: 7 additions & 4 deletions src/client.d
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ class User
uint status = Status.offline;
bool privileged;

if (msg.user == server_user) {
if (msg.user == server_user) {
debug (user) writefln(
"Telling user %s that host %s is online",
blue ~ username ~ norm, blue ~ server_user ~ norm
Expand All @@ -559,7 +559,8 @@ class User
"Telling user %s that user %s is offline",
blue ~ username ~ norm, red ~ msg.user ~ norm
);
privileged = server.db.get_user_privileges(msg.user) > Clock.currTime.toUnixTime;
privileged = server.db.get_user_privileges(msg.user)
> Clock.currTime.toUnixTime;
}
else {
debug (user) writefln(
Expand Down Expand Up @@ -630,14 +631,16 @@ class User
if (msg.user == server_user) {
server.admin_message(this, msg.message);
}
else if (user) { // user is connected
else if (user) {
// user is connected
auto pm = new PM(msg.message, username, msg.user);
const new_message = true;

PM.add_pm(pm);
user.send_pm(pm, new_message);
}
else if (server.db.user_exists(msg.user)) { // user is not connected but exists
else if (server.db.user_exists(msg.user)) {
// user exists but not connected
auto pm = new PM(msg.message, username, msg.user);
PM.add_pm(pm);
}
Expand Down
28 changes: 14 additions & 14 deletions src/messages.d
Original file line number Diff line number Diff line change
Expand Up @@ -499,16 +499,16 @@ class URoomSearch : Message
}

class UUserPrivileged : Message
{ // Client wants to know if someone has privileges
string user; // user name
{ // Client wants to know if someone has privileges
string user; // user name

this(ubyte[] buf)
{
super(buf);
user = reads();
}
}
this(ubyte[] buf)
{
super(buf);

user = reads();
}
}

class UAdminMessage : Message
{ // An admin sends a message
Expand Down Expand Up @@ -640,8 +640,8 @@ class SGetUserStatus : Message
super(GetUserStatus);

writes(username); // username
writei(status); // user status(see the class User)
writeb(privileged); // is user privileged
writei(status); // user status (see the User class)
writeb(privileged); // is user privileged
}
}

Expand Down Expand Up @@ -700,7 +700,7 @@ class SJoinRoom : Message
foreach (username ; usernames)
{
writei(speeds [username]); // speed of each user
writei(upload_numbers [username]); // number of files uploaded ever
writei(upload_numbers [username]); // number of files uploaded ever
writei(somethings [username]); // something ?
writei(shared_files [username]); // nb of shared files
writei(shared_folders [username]); // nb of shared folders
Expand Down Expand Up @@ -770,7 +770,7 @@ class SConnectToPeer : Message
writei(address); // IP address of the peer to connect to
writei(port); // port to use
writei(token); // message token
writeb(privileged); // is user privileged
writeb(privileged); // is user privileged
writei(unknown);
writei(obfuscated_port);
}
Expand Down Expand Up @@ -841,7 +841,7 @@ class SGetGlobalRecommendations : Message
{
super(GlobalRecommendations);

writei(list.length); // if you can't guess, you should have stopped several lines ago...
writei(list.length);
foreach (artist, level ; list)
{
writes(artist); // artist name
Expand Down
4 changes: 2 additions & 2 deletions src/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ class Server
}

writefln(
"%s process %s listening on port %s",
"%s %s process %s listening on port %s",
bg_w ~ "" ~ red ~ "" ~ norm ~ bg_w ~ "" ~ norm ~ bold
~ "Soulfind" ~ VERSION ~ norm, thisProcessID, port
~ "Soulfind", VERSION ~ norm, thisProcessID, port
);

auto read_socks = new SocketSet(max_users + 1);
Expand Down

0 comments on commit 5863e49

Please sign in to comment.