15 #include "privacymanager.h"
16 #include "clientbase.h"
26 : m_parent( parent ), m_privacyListHandler( 0 )
43 const std::string&
id = m_parent->
getID();
48 Tag *q =
new Tag( iq,
"query" );
51 m_parent->
trackID(
this,
id, PLRequestNames );
58 const std::string&
id = m_parent->
getID();
63 Tag *q =
new Tag( iq,
"query" );
65 Tag *l =
new Tag( q,
"list" );
68 m_parent->
trackID(
this,
id, PLRequestList );
75 const std::string&
id = m_parent->
getID();
80 Tag *q =
new Tag( iq,
"query" );
82 Tag *l =
new Tag( q,
"list" );
85 m_parent->
trackID(
this,
id, PLRemove );
92 const std::string&
id = m_parent->
getID();
97 Tag *q =
new Tag( iq,
"query" );
99 Tag *d =
new Tag( q,
"default" );
102 m_parent->
trackID(
this,
id, PLDefault );
103 m_parent->
send( iq );
109 const std::string&
id = m_parent->
getID();
111 Tag *iq =
new Tag(
"iq" );
114 Tag *q =
new Tag( iq,
"query" );
116 new Tag( q,
"default" );
118 m_parent->
trackID(
this,
id, PLUnsetDefault );
119 m_parent->
send( iq );
125 const std::string&
id = m_parent->
getID();
127 Tag *iq =
new Tag(
"iq" );
130 Tag *q =
new Tag( iq,
"query" );
132 Tag *a =
new Tag( q,
"active" );
135 m_parent->
trackID(
this,
id, PLActivate );
136 m_parent->
send( iq );
142 const std::string&
id = m_parent->
getID();
144 Tag *iq =
new Tag(
"iq" );
147 Tag *q =
new Tag( iq,
"query" );
149 new Tag( q,
"active" );
151 m_parent->
trackID(
this,
id, PLUnsetActivate );
152 m_parent->
send( iq );
160 return std::string();
162 const std::string&
id = m_parent->
getID();
164 Tag *iq =
new Tag(
"iq" );
167 Tag *q =
new Tag( iq,
"query" );
169 Tag *l =
new Tag( q,
"list" );
173 PrivacyListHandler::PrivacyList::const_iterator it = list.begin();
174 for( ; it != list.end(); ++it )
176 Tag *i =
new Tag( l,
"item" );
178 switch( (*it).type() )
193 switch( (*it).action() )
203 int pType = (*it).packetType();
207 new Tag( i,
"message" );
209 new Tag( i,
"presence-in" );
211 new Tag( i,
"presence-out" );
220 m_parent->
trackID(
this,
id, PLStore );
221 m_parent->
send( iq );
236 Tag *iq =
new Tag(
"iq" );
239 m_parent->
send( iq );
248 if( !m_privacyListHandler )
275 Tag::TagList::const_iterator it = l.begin();
276 for( ; it != l.end(); ++it )
278 const std::string& name = (*it)->findAttribute(
"name" );
279 if( (*it)->name() ==
"default" )
281 else if( (*it)->name() ==
"active" )
283 else if( (*it)->name() ==
"list" )
284 lists.push_back( name );
297 Tag::TagList::const_iterator it = l.begin();
298 for( ; it != l.end(); ++it )
304 const std::string& t = (*it)->findAttribute(
"type" );
307 else if( t ==
"group" )
309 else if( t ==
"subscription" )
314 const std::string& a = (*it)->findAttribute(
"action" );
317 else if( a ==
"deny" )
322 const std::string& value = (*it)->findAttribute(
"value" );
325 Tag::TagList::const_iterator it_c = c.begin();
326 for( ; it_c != c.end(); ++it_c )
328 if( (*it_c)->name() ==
"iq" )
330 else if( (*it_c)->name() ==
"presence-out" )
332 else if( (*it_c)->name() ==
"presence-in" )
334 else if( (*it_c)->name() ==
"message" )
338 PrivacyItem item( type, action, packetType, value );
339 items.push_back( item );
349 switch( stanza->
error() )
375 m_privacyListHandler = plh;
380 m_privacyListHandler = 0;