TIdIRC OnNames IsOp

Giganews Newsgroups
Subject: TIdIRC OnNames IsOp
Posted by:  Danila Vershinin (profyprepATyandexDOTru)
Date: Tue, 25 Jul 2006

Hello,
I am trying to iterate through channel user list and assign different icons
(in a TListView)  to people having ops on that channel:

In OnNames event for TIdIRC I have the following:

void __fastcall TfrmMain::ircNames(TObject *Sender, TIdIRCUsers *AUsers,
      TIdIRCChannel *AChannel)
{
for (int i=0; i<AUsers->Count;i++)
    {
    TIdIRCUser *usr = AUsers->Items[i];
    TListItem *lu = lvUsers->Items->Add();
    String Nick = usr->Nick;
    lu->Caption = Nick;
    if (irc->IsOp(Nick)) lu->ImageIndex = 0;
    else lu->ImageIndex = -1;
    }
}

IsOp would never return true since in this piece of code it deals with
nicknames without status tokens. For example, I have ops on the channel:
@Danilka. But TIdIRCUser's Nick would containg Danilka only (without @
required for that function to work correctly in my code)
So my question is, ..how do I check whether a user has ops on a particular
channel (or any channel...) ?
I am using C++ Builder 6 and Indy 9. Also... when I use Delphi 7 + Indy 10
OnNickNameListReceived is never triggered when I join a channel. Maybe it's
the way I use it...
Just for a test I did this:
procedure TForm1.FormCreate(Sender: TObject);
begin
irc.Connect;
irc.Join('#amour');
end;

procedure TForm1.ircNicknamesListReceived(ASender: TIdContext;
  const AChannel: String; ANicknameList: TStrings);
begin
ShowMessage(ANickNameList.Text);
end;

The event never fired.  But raw irc commands contain the following:
353 Smska23 = #amour :+YANKA Smska23 óÍÓËÁ íÉÌÁÑ_ÂÒÀÎÅÔÏÞËÁ  // nicks in the
channel
366 Smska23 #amour :End of /NAMES list.
Comparing two TIdIRC.pas from Indy 9 and Indy 10 I found that IRC command
353 is never mentioned in Indy 10.  Is this correct?
Also..doesn't Indy 10 TIdIRC support multiple channels? I couldn't find
anything related to TIdIRCChannel as it is back in Indy 9. ?

Replies