These are chat archives for IndySockets/Indy

14th
Oct 2018
Alpinador
@dixiewarp_twitter
Oct 14 2018 07:06
Remy, finally i left this 2 functions for fill the listbox of users with nicknames and for messages with nickname prior the message:

void __fastcall TForm4::IdIRC1NicknamesListReceived(TIdContext ASender, const UnicodeString AChannel,
TStrings
ANicknameList)
{
int i=0;
do
{

    Usuarios->Items->Add(ANicknameList->Strings[i].c_str());
    i++;

 } while(i < ANicknameList->Count -1);

}
//---------------------------------------------------------------------------

void __fastcall TForm4::IdIRC1PrivateMessage(TIdContext *ASender, const UnicodeString ANickname,
const UnicodeString AHost, const UnicodeString ATarget,
const UnicodeString AMessage)
{
ListBox1->Items->Add(ANickname + ": " + AMessage);
}
//---------------------------------------------------------------------------

it runs fine enough
Remy Lebeau
@rlebeau
Oct 14 2018 18:30
@dixiewarp_twitter why are you using a do..while loop instead of a for loop? You are skipping the last name in the list. And you don't need to use c_str() either.

```void __fastcall TForm4::IdIRC1NicknamesListReceived(TIdContext ASender, const UnicodeString AChannel, TStrings ANicknameList)
{
int i=0;
do
{

Usuarios->Items->Add(ANicknameList->Strings[i].c_str());
i++;

} while(i < ANicknameList->Count -1);
}

```void __fastcall TForm4::IdIRC1NicknamesListReceived(TIdContext ASender, const UnicodeString AChannel,TStrings ANicknameList)
{
for (int i = 0; i < ANicknameList->Count; ++i)
{

Usuarios->Items->Add(ANicknameList->Strings[i]);

}
}```

Stupid mobile app, I can't format the code correctly
Alpinador
@dixiewarp_twitter
Oct 14 2018 18:33
i'll try that for...