Not logged in. · Lost password · Register
Forum: agsXMPP SDK Support RSS
Avatar
sreedevi1984 #1
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
Subject: unblock a contact
Is there any option to unblock a contact? help me please..

thanks,

Sreedevi.
Avatar
Alex #2
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
This depends on the protocol you use for blocking your contacts. Please take a look at privacy lists in the RFC's

Alex
Alexander Gnauck
AG-Software
Avatar
sreedevi1984 #3
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
I am using xep-0016.

Blocking a contact is not working properly. Please help me.

SEND: <iq xmlns="jabber:client" id="agsXMPP_14" type="set"><query xmlns="jabber:iq:privacy"><list name="public"><item action="deny" order="1" type="jid" value="viji@localhost" /></list></query></iq>

RECV: <iq xmlns="jabber:client" id="agsXMPP_14" type="result" />


This is the xml debug. And the code is below :


agsXMPP.protocol.iq.privacy.RuleManager ruleManager = new agsXMPP.protocol.iq.privacy.RuleManager();

Jid jidToBlock = new Jid("viji@localhost")
ruleManager.BlockByJid(jidToBlock,1,Stanza.OutgoingPresence);
ruleManager.BlockByJid(jidToBlock,1,Stanza.Message);

I am blocking the user's message and also the outgoing(my) presence.

 What is the problem.. ? Is there any problem with the order of item while blocking....? Can u please explain what is the significance of order here...? Please help me.

Thanks
Sreedevi.
This post was edited on 2007-02-22, 07:58 by sreedevi1984.
Avatar
Jabberer #4
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Hello,

your Debug XML which sets up the list looks OK.

  • Do you activate the list on login?
  • Do you have a default list?
Software Developer
AG-Software
Avatar
sreedevi1984 #5
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
No I dont have any default list.... and I dont activate list on login..
Avatar
Jabberer #6
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Thats the problem then.

If no privacy list is active all stanzas are accepted.
See also the Business Rules in XEP-0016:
http://www.xmpp.org/extensions/xep-0016.html#protocol-rules
Software Developer
AG-Software
Avatar
sreedevi1984 #7
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #5
In the xep-0016 document , a message element is associated with the list element as follows :

Example 29. User blocks based on JID

<iq from='romeo@example.net/orchard' type='set' id='msg1'>
<query xmlns='jabber:iq:privacy'>
  <list name='message-jid-example'>
    <item type='jid'
          value='tybalt@example.com'
          action='deny'
          order='3'>
      <message/>
    </item>
  </list>
</query>
</iq>

But in the xml deug which i got, the message element is not there. Is this the cause of the problem ?

Also, when we send this xml to the server, server has to send some xml to that blocked user, right ? But no xml is coming in the side of the blocked user. So how can that user know that he is blocked ? Please guide me...

Thank you,
Sreedevi.
Avatar
sreedevi1984 #8
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #6
Is there any method to activate the list in agsxmpp ?
Avatar
Jabberer #9
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Quote by sreedevi1984:
Is there any method to activate the list in agsxmpp ?

ChangeActiveList in the PrivacyManager should do that for you.
Software Developer
AG-Software
Avatar
Jabberer #10
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #7
Quote by sreedevi1984:
In the xep-0016 document , a message element is associated with the list element as follows :

Example 29. User blocks based on JID

<iq from='romeo@example.net/orchard' type='set' id='msg1'>
<query xmlns='jabber:iq:privacy'>
  <list name='message-jid-example'>
    <item type='jid'
          value='tybalt@example.com'
          action='deny'
          order='3'>
      <message/>
    </item>
  </list>
</query>
</iq>

But in the xml deug which i got, the message element is not there. Is this the cause of the problem ?

no, the message element means "block only messages".
Software Developer
AG-Software
Avatar
sreedevi1984 #11
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
yes, my requirement is block only the messages and outgoing presence...
in this case, message element should be there, right ?
Avatar
Jabberer #12
Member since Feb 2006 · 249 posts
Group memberships: Members
Show profile · Link to this post
Quote by XEP-0016:
  • <message/> -- blocks incoming message stanzas
  • <iq/> -- blocks incoming IQ stanzas
  • <presence-in/> -- blocks incoming presence notifications
  • <presence-out/> -- blocks outgoing presence notifications

which means you have to include message and precence then. If you wanna block inccoming and outgoing presence you include:
  1. <message/>
  2. <presence-in/>
  3. <presence-out/>
Software Developer
AG-Software
Avatar
sreedevi1984 #13
Member since Oct 2006 · 38 posts
Group memberships: Members
Show profile · Link to this post
My code to block a contact is the following :

agsXMPP.protocol.iq.privacy.RuleManager ruleManager = new agsXMPP.protocol.iq.privacy.RuleManager();

Jid jidToBlock = new Jid("viji@localhost")
ruleManager.BlockByJid(jidToBlock,1,Stanza.OutgoingPresence);
ruleManager.BlockByJid(jidToBlock,1,Stanza.Message);

Will this add the <message/> and <presence-out/>   ?? In my xml debug, it's not there.

Another doubt is, When I block a user, what xml will that user get? In my application, nothing is receiving in the blocked user's side... Then how can he know that he is blocked ?

Please help me...

Sreedevi
This post was edited on 2007-02-23, 09:21 by sreedevi1984.
Avatar
Alex #14
Member since Feb 2003 · 4246 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Hello,

here is a sample code which edits or adds a privacy list. There is one entry which blocks Messages, PresenceIn and PresenceOut

  1. PrivacyIq piq = new PrivacyIq();
  2. piq.Type = IqType.set;
  3.  
  4. agsXMPP.protocol.iq.privacy.Item itm = new agsXMPP.protocol.iq.privacy.Item();
  5. itm.Type = agsXMPP.protocol.iq.privacy.Type.jid;
  6. itm.Val = "user@server.org";
  7. itm.Order =1;
  8. itm.Action = agsXMPP.protocol.iq.privacy.Action.deny;
  9. itm.Stanza = agsXMPP.protocol.iq.privacy.Stanza.Message | agsXMPP.protocol.iq.privacy.Stanza.IncomingPresence | agsXMPP.protocol.iq.privacy.Stanza.OutgoingPresence;
  10.  
  11. List list = new List("listname");
  12. list.AddItem(itm);
  13.  
  14. piq.Query.AddList(list);

Alex
Alexander Gnauck
AG-Software
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP SDK Support RSS