private externallist CreatePresRulesExternalList(String list) { externallist eList = new externallist(); eList.entry = new anchorType[1]; eList.entry[0] = new anchorType(); eList.entry[0].anc = this.GetResourceListAnchorAsString(list); return(eList); }
private ruleset CreateOMAPresRulesDocument() { ruleset document = new ruleset(); //<cr:conditions> // <cr:identity> // <cr:one id="sip:[email protected]" /> // </cr:identity> //</cr:conditions> identityType identityCond = new identityType(); identityCond.Items = new oneType[1]; oneType otype = new oneType(); otype.id = this.xcapStack.XUI; identityCond.Items[0] = otype; //<cr:conditions> // <anonymous-request xmlns="urn:oma:xml:xdm:common-policy" /> //</cr:conditions> anonymousRequest anonymousCond = new anonymousRequest(); // <cr:conditions> // <other-identity xmlns="urn:oma:xml:xdm:common-policy" /> //</cr:conditions> otherIdentity otherIdentityCond = new otherIdentity(); // <cr:conditions> // <external-list xmlns="urn:oma:xml:xdm:common-policy"> // <entry anc="http://doubango.org:8080/services/resource-lists/users/sip:[email protected]/index/~~/resource-lists/list%5B@name=%22oma_grantedcontacts%22%5D" /> // </external-list> //</cr:conditions> externallist omaGrantedCond = this.CreatePresRulesExternalList(SpecialNames.SHARED_OMA_GRANTEDCONTACTS); //<cr:conditions> // <external-list xmlns="urn:oma:xml:xdm:common-policy"> // <entry anc="http://doubango.org:8080/services/resource-lists/users/sip:[email protected]/index/~~/resource-lists/list%5B@name=%22oma_blockedcontacts%22%5D" /> // </external-list> //</cr:conditions> externallist omaBlockedCond = this.CreatePresRulesExternalList(SpecialNames.SHARED_OMA_BLOCKEDCONTACTS); document.rule = new ruleType[] { CreatePresRule(SpecialNames.PRESRULES_OMA_ALLOW_OWN, "allow", true, identityCond), CreatePresRule(SpecialNames.PRESRULES_RCS_ALLOW_SERVICE_ANONYMOUS, "allow", true, anonymousCond), CreatePresRule(SpecialNames.PRESRULES_OMA_UNLISTED, "confirm", false, otherIdentityCond), CreatePresRule(SpecialNames.PRESRULES_OMA_GRANTED_CONTACTS, "allow", true, omaGrantedCond), CreatePresRule(SpecialNames.PRESRULES_OMA_BLOCKED_CONTACTS, "block", false, omaBlockedCond) }; String documentUrl; //if(this.xcapDocumentsUris.ContainsKey()) lock (this.xcapSelector) { this.xcapSelector.reset(); this.xcapSelector.setAUID(XcapService.XCAP_AUID_OMA_PRES_RULES_ID); documentUrl = this.xcapSelector.getString(); } byte[] payload = this.Serialize(document, true, true, this.GetSerializerNSFromAUID(XcapService.XCAP_AUID_OMA_PRES_RULES_ID)); MyXcapMessage xcapMessage = this.xcapStack.PutDocument(documentUrl, payload, (uint)payload.Length, XcapService.XCAP_AUID_OMA_PRES_RULES_MIME_TYPE); if (xcapMessage != null && XcapService.IsSuccessCode(xcapMessage.Code)) { return(document); } return(null); }