sendContactList();
}
//Solved ADL long-contact-list issue - BLuEGoD
public void sendContactList(){
AbstractMessenger messenger = (AbstractMessenger)session.getMessenger();
MsnProtocol protocol = messenger.getActualMsnProtocol();
if (protocol.after(MsnProtocol.MSNP12))
{
MsnContactListImpl contactList = (MsnContactListImpl) session
.getMessenger().getContactList();
MsnContact[] cs = contactList.getContacts();
int cs_size = cs.length;
Queue<MsnContact> csq = new LinkedList<MsnContact>();
try
{
// don't know why 220 instead of ~250, but MSN server don't like it
// we should put this lower if the server disconnects after an ADL is made - BLuEGoD
// Each ADL command may contain up to 150 contacts - damencho
for(int i=0, j=1; i < cs_size; i++,j++)
{
if(cs[i]!=null)
csq.add(cs[i]);
if(j == 150 || i == cs_size-1)
{
//waitFor(6000);
OutgoingADL o1 = new OutgoingADL(messenger.getActualMsnProtocol());
if(firstADLReply)
ADLSent = (cs_size-1)==i?true:false;
o1.addContacts(csq.toArray(new MsnContact[j] ));
messenger.send(o1);
j=0;
csq.clear();
}
}