Доброго времени суток. Использую компонент TICQClient Есть такой код.
| Код | procedure TMainForm.ICQClientServerListRecv(Sender: TObject; SrvContactList: TList); var i : Word; j : integer; UserInfo : TUINEntry; b : boolean; Empty : boolean; //если контакт-лист был пуст U : string; begin
//Узнаём пуст список контактов или нет //Empty = false - список не пуст //Empty = true - список пуст Empty:=false; if ContactList.Items.Count=0 then Empty:=true;
if SrvContactList.Count>0 then for i:=0 to SrvContactList.Count-1 do begin UserInfo:=PUINEntry(SrvContactList.Items[i])^; if UserInfo.CGroupID<>UserInfo.UIN then begin b:=false; U:=IntToStr(UserInfo.UIN);
//Если контакты были не пусты, то ищем контакт в листе if not Empty then for j:=0 to ContactList.Items.Count-1 do if not (InInvisible(ContactList.Items[i].SubItems[0]) and InVisible(ContactList.Items[i].SubItems[0])) and (U=ContactList.Items[j].SubItems[0]) then begin b:=true; exit; end;
//Если такой контакт не встречается в списке, то добавляем его if not b then begin with ContactList.Items.Add do begin if UserInfo.Nick<>'' then Caption:=UserInfo.Nick //Если ник есть, то пишем его else Caption:=U; //Если нет ника, то пишем УИН ImageIndex:=7; SubItems.Add(U); end end; end; end; ICQClient.DestroyUINList(SrvContactList);
Application.ProcessMessages;
//Добавляем контакт в лист for i:=0 to ContactList.Items.Count-1 do ICQClient.AddContact(strtoint(ContactList.Items[i].SubItems[0]));
end;
|
Вот эта функция подвешивает прогу. Скажите, что здесь может подвешивать?
ЗЫ Выкладываю ещё код обработки процедуры смены статуса. На всякий случай. =)
| Код | procedure TMainForm.ICQClientStatusChange(Sender: TObject; UIN: String; Status: Cardinal); var i,j : integer; img : byte; s : string; begin if ContactList.Items.Count>0 then for i:=0 to ContactList.Items.Count-1 do if ContactList.Items[i].SubItems[0]=UIN then begin s:=StatusToStr(Status); if s='В сети' then img:=0 else if s='Готов поболтать' then img:=1 else if s='Отошёл' then img:=2 else if s='Не беспокоить' then img:=3 else if s='Занят' then img:=4 else if s='Недоступен' then img:=5 else if s='Невидимый' then img:=6 else if s='Злой' then img:=12 else if s='Дома' then img:=13 else if s='На работе' then img:=14 else if s='Депрессия' then img:=15 else if s='Кушаю' then img:=16 else img:=7; for j:=0 to MessForm.Messages.PageCount-1 do if MessPages[j].UIN=UIN then MessForm.Messages.Pages[j].ImageIndex:=img; ContactList.Items[i].ImageIndex:=img; Exit; end; end;
|
|