From d2d5348958a91ab3edea3252f630f2d4cd07c6b2 Mon Sep 17 00:00:00 2001 From: Elijahr2411 Date: Tue, 29 Aug 2023 23:44:02 -0400 Subject: [PATCH] add Rename() --- CollabVMSharp/CollabVMClient.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CollabVMSharp/CollabVMClient.cs b/CollabVMSharp/CollabVMClient.cs index 965081b..2e9f84e 100644 --- a/CollabVMSharp/CollabVMClient.cs +++ b/CollabVMSharp/CollabVMClient.cs @@ -821,6 +821,16 @@ public class CollabVMClient { this.commands.Add(cmd, callback); } + /// + /// Change client username + /// + /// New username. Null for the server to assign a guest name + public void Rename(string? newname = null) + { + if (newname == null) SendMsg(Guacutils.Encode("rename")); + else SendMsg(Guacutils.Encode("rename", newname)); + } + private void ProcessCommand(string username, string cmd) { // I stole this from stackoverflow var re = new Regex("(?<=\")[^\"]*(?=\")|[^\" ]+");