[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Qt-question
From:       Waldo Bastian <bastian () kde ! org>
Date:       2001-08-08 21:35:47
[Download RAW message or body]

On Wednesday 08 August 2001 02:06 pm, Jeroen Jacobs wrote:
> Hi,
>
> I'm trying to write an irc chat-application, but I've stumbled across a few
> problems.

I think humans are genetically prepogrammed to write irc-clients :-)

> void QchatView::slotEnter()
> {
> 	datasend=chatin->text();
>     chatout->insertLine(datasend);
>     datasend.append("\r\n");
>     *textsocket << (&datasend);
> 	 ircsocket->flush();
> }
> ---
>
> but the server never replies to the things I type. So I think it's the
> QString class that causes my problem (because It's unicode,right?).

QTextStream converts to some 8-bit encoding. You can help it a bit by doing 
e.g. textsocket->setEncoding("Latin1"); just after you made it to make sure 
that you know which encoding it uses. You will run into problems when you 
have a name that doesn't fit into latin1 though.
(Does the IRC protocol specify how to handle non-ASCII characters?)

Apart from that, I think the line 
   *textsocket << (&datasend); 
should read like:
   (*texsocket) << datasend;

Not sure if the () are needed, but it never hurts.

Cheers,
Waldo
-- 
KDE 2.2: We deliver.
 
>> Visit http://master.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic