protected string privacyCategoryToString(VisibilityCategory c) { switch (c) { case VisibilityCategory.LastSeenTime: return("last"); case VisibilityCategory.Status: return("status"); case VisibilityCategory.ProfilePhoto: return("profile"); default: throw new Exception("Invalid privacy category"); } }
public void SendSetPrivacySetting(VisibilityCategory category, VisibilitySetting setting) { ProtocolTreeNode node = new ProtocolTreeNode("iq", new[] { new KeyValue("to", "s.whatsapp.net"), new KeyValue("id", TicketCounter.MakeId()), new KeyValue("type", "set"), new KeyValue("xmlns", "privacy") }, new ProtocolTreeNode[] { new ProtocolTreeNode("privacy", null, new ProtocolTreeNode[] { new ProtocolTreeNode("category", new [] { new KeyValue("name", this.privacyCategoryToString(category)), new KeyValue("value", this.privacySettingToString(setting)) }) }) }); this.SendNode(node); }
public void SendSetPrivacySetting(VisibilityCategory category, VisibilitySetting setting) { ProtocolTreeNode node = new ProtocolTreeNode("iq", new[] { new KeyValue("to", "s.whatsapp.net"), new KeyValue("id", TicketCounter.MakeId("setprivacy_")), new KeyValue("type", "set"), new KeyValue("xmlns", "privacy") }, new ProtocolTreeNode[] { new ProtocolTreeNode("privacy", null, new ProtocolTreeNode[] { new ProtocolTreeNode("category", new [] { new KeyValue("name", this.privacyCategoryToString(category)), new KeyValue("value", this.privacySettingToString(setting)) }) }) }); this.SendNode(node); }
protected string privacyCategoryToString(VisibilityCategory c) { switch (c) { case VisibilityCategory.LastSeenTime: return "last"; case VisibilityCategory.Status: return "status"; case VisibilityCategory.ProfilePhoto: return "profile"; default: throw new Exception("Invalid privacy category"); } }