[jadmin] Add contacts to roster

Beatriz Sepulveda bea_sepulveda at yahoo.com.ar
Fri Aug 5 10:04:25 CDT 2005


Hi, I'm using jabberd2 server on linux. I'm trying to
insert new contacts to roster-items table using the
jabber-net library on my client application, but I
need to set the "to", "from" and "ask" field... which
is the correct format of the xml to send to the
server? Currently the server save a wrong data to the
table (always save "0").

My current AddContact function:

private void addContact(string username, string
group){			
jabber.protocol.iq.RosterIQ riq = new
jabber.protocol.iq.RosterIQ(jabberClient1.Document);
riq.Type = jabber.protocol.client.IQType.set;
jabber.protocol.iq.Roster r = 
(jabber.protocol.iq.Roster) riq.Query;
			
jabber.protocol.iq.Item i = r.AddItem();
i.JID = username;
i.Nickname = username;
i.AddGroup(group);
i.Subscription = (jabber.protocol.iq.Subscription)2; 
i.Ask = (jabber.protocol.iq.Ask)(-1);
				
string n= "<iq id=\"JN_5\" type=\"set\"><query
xmlns=\"jabber:iq:roster\"><item
jid=\"xxx at myserver.com\" name=\"xxx at myserver.com\"
subscription=\"both\"><group>Friends</group></item></query></iq>";
				
jabberClient1.Write(n);
sendPacket(i.JID);
}

Thanks,
Beatriz.


	


	
		
___________________________________________________________ 
1GB gratis, Antivirus y Antispam 
Correo Yahoo!, el mejor correo web del mundo 
http://correo.yahoo.com.ar 




More information about the JAdmin mailing list