66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace SharpChat.Packet {
|
|
public class LegacyCommandResponse : ServerPacket {
|
|
private readonly bool IsError;
|
|
private readonly string StringId;
|
|
private readonly object[] Arguments;
|
|
|
|
public LegacyCommandResponse(
|
|
string stringId,
|
|
bool isError = true,
|
|
params object[] args
|
|
) {
|
|
IsError = isError;
|
|
StringId = stringId;
|
|
Arguments = args;
|
|
}
|
|
|
|
public override string Pack() {
|
|
StringBuilder sb = new();
|
|
|
|
sb.AppendFormat(
|
|
"2\t{0}\t-1\t{1}\f{2}",
|
|
DateTimeOffset.Now.ToUnixTimeSeconds(),
|
|
IsError ? 1 : 0,
|
|
StringId
|
|
);
|
|
|
|
foreach(object arg in Arguments)
|
|
sb.AppendFormat("\f{0}", arg);
|
|
|
|
sb.AppendFormat("\t{0}\t10010", SequenceId);
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
|
|
// Abbreviated class name because otherwise shit gets wide
|
|
public static class LCR {
|
|
public const string COMMAND_NOT_ALLOWED = "cmdna";
|
|
public const string COMMAND_FORMAT_ERROR = "cmderr";
|
|
public const string IP_ADDRESS = "ipaddr";
|
|
public const string USER_NOT_FOUND = "usernf";
|
|
public const string NAME_IN_USE = "nameinuse";
|
|
public const string CHANNEL_INSUFFICIENT_HIERARCHY = "ipchan";
|
|
public const string CHANNEL_INVALID_PASSWORD = "ipwchan";
|
|
public const string CHANNEL_NOT_FOUND = "nochan";
|
|
public const string CHANNEL_ALREADY_EXISTS = "nischan";
|
|
public const string CHANNEL_NAME_INVALID = "inchan";
|
|
public const string CHANNEL_CREATED = "crchan";
|
|
public const string CHANNEL_DELETE_FAILED = "ndchan";
|
|
public const string CHANNEL_DELETED = "delchan";
|
|
public const string CHANNEL_PASSWORD_CHANGED = "cpwdchan";
|
|
public const string CHANNEL_HIERARCHY_CHANGED = "cprivchan";
|
|
public const string USERS_LISTING_ERROR = "whoerr";
|
|
public const string USERS_LISTING_CHANNEL = "whochan";
|
|
public const string USERS_LISTING_SERVER = "who";
|
|
public const string INSUFFICIENT_HIERARCHY = "rankerr";
|
|
public const string MESSAGE_DELETE_ERROR = "delerr";
|
|
public const string KICK_NOT_ALLOWED = "kickna";
|
|
public const string USER_NOT_BANNED = "notban";
|
|
public const string USER_UNBANNED = "unban";
|
|
public const string FLOOD_WARN = "flwarn";
|
|
}
|
|
}
|