Bug 70777

Summary: Large messages close socket on MSN
Product: [Unmaintained] kopete Reporter: Casey Allen Shobe <cshobe>
Component: MSN PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: thiago
Priority: HI    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Casey Allen Shobe 2003-12-18 21:22:55 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

If I paste a whole arseload of text into a chat window and try to send it, it does not tell me that the text was too long, only that the other user has closed the socket and that my message did not get sent correctly.  I've also had problems with long messages on Gadu-Gadu and other protocols.

IMHO, the choice from the SMS plugin (regarding what to do when message length is exceeded) should become a global choice in Kopete configuration, and each plugin should just be able to tell libkopete what the maximum message length for that protocol is.
Comment 1 Olivier Goffart 2003-12-18 22:22:43 UTC
Yes i know, the size of a message is limited to 1664 char (header included)
(and that's because the header is included that it's hard to calcul the max size since i don't know the header's siez in advance)
Comment 2 Matt Rogers 2003-12-19 05:55:52 UTC
Couldn't you just create the whole message you were going to send (header included) and then make sure it's length is less than 1664 characters? I don't know how you'd notify the user that the message didn't get sent, but you might be able to use an existing string for that. 
Comment 3 Martijn Klingens 2003-12-19 09:22:09 UTC
Subject: Re: [Kopete-devel]  Large messages close socket on MSN (and other problems)

Isn't it even simpler to just limit messages to, say, 1600 characters even if 
they could be a bit larger. It's like a user is going to care if a message is 
20 characters too small on a total of 1600+ :)

(Unlike e.g. SMS, which is limited to 160, where every char counts.)

Comment 4 Casey Allen Shobe 2003-12-20 12:07:16 UTC
Subject: Re:  Large messages close socket on MSN (and other problems)

Martijn Klingens (Friday 19 December 2003 03:22)
> Isn't it even simpler to just limit messages to, say, 1600 characters even
> if they could be a bit larger. It's like a user is going to care if a
> message is 20 characters too small on a total of 1600+ :)

Yes, they are.  This is why the choice in SMS between cutting of a message, 
breaking it into multiple, or cancelling the message, should apply to all 
protocols.  If the user wants to send large messages, they should be able to 
without problem in whatever manner they see fit.  Furthermore this makes more 
sense as a single global option than a protocol option.

On a related note, split messages should be each shown as a separate message 
(this is not currently the case on IRC, where a message is split at every 
linebreak - Kopete just shows one message to you even when you send 20).

Comment 5 Martijn Klingens 2003-12-20 12:48:52 UTC
Subject: Re: [Kopete-devel]  Large messages close socket on MSN (and other problems)

On Saturday 20 December 2003 12:07, Casey Allen Shobe wrote:
> > Isn't it even simpler to just limit messages to, say, 1600 characters
> > even if they could be a bit larger. It's like a user is going to care if
> > a message is 20 characters too small on a total of 1600+ :)
>
> Yes, they are.

Are they? Do you really want to send 1621 characters per messages instead of 
1600? Come on, with those figures it's really not an issue anymore, I'm not 
talking about the 160-char limit of SMS here.

> This is why the choice in SMS between cutting of a message, 
> breaking it into multiple, or cancelling the message, should apply to all
> protocols.

Agreed.

> If the user wants to send large messages, they should be able 
> to without problem in whatever manner they see fit.  Furthermore this makes
> more sense as a single global option than a protocol option.

I think it should be an account option. I'm still considering to make the SMS 
plugin capable of sending messages through my phone's data cable, so the 
receiver sees my phone number in the message. But in that case I'm actually 
charged for each message, so I'd want a different setting for SMS.

> On a related note, split messages should be each shown as a separate
> message (this is not currently the case on IRC, where a message is split at
> every linebreak - Kopete just shows one message to you even when you send
> 20).

You mean at the sending end? Otherwise please explain how the receiver can 
detect the difference between split messages and multiple independent 
messages.

If at the sending end, yes, I agree.

Comment 6 Casey Allen Shobe 2003-12-20 14:10:05 UTC
Subject: Re:  Large messages close socket on MSN (and other problems)

Martijn Klingens (Saturday 20 December 2003 06:48)
> > Yes, they are.
>
> Are they? Do you really want to send 1621 characters per messages instead
> of 1600? Come on, with those figures it's really not an issue anymore, I'm
> not talking about the 160-char limit of SMS here.

I think you're talking about something else.  I am saying that a user is going 
to care if they send a 3000-character message and only 1600 characters get 
through and they have no way to change that behavior to split across multiple 
messages.

> I think it should be an account option.

I don't think account-level configureability for this that necessary, but 
okay.

> You mean at the sending end?

Of course.

Comment 7 Martijn Klingens 2003-12-20 14:33:37 UTC
Subject: Re: [Kopete-devel]  Large messages close socket on MSN (and other problems)

On Saturday 20 December 2003 14:10, Casey Allen Shobe wrote:
> I think you're talking about something else.  I am saying that a user is
> going to care if they send a 3000-character message and only 1600
> characters get through and they have no way to change that behavior to
> split across multiple messages.

Oh, ok, I agree there. I was talking about the per-message limit.

Actually, I wouldn't object to simply limiting the amount of characters that a 
user can type in the edit box instead of splitting messages (at least for KDE 
3.2).

> > I think it should be an account option.
>
> I don't think account-level configureability for this that necessary, but
> okay.

Well, generally I agree, but in the case where you pay per message (SMS 
through phone) it makes sense to have a separate option. Perhaps add the 
ability in the API to have per-account options, but have the GUI only there 
where it matters?

Comment 8 Matt Rogers 2004-01-16 04:51:17 UTC
*** Bug 71195 has been marked as a duplicate of this bug. ***
Comment 9 Matt Rogers 2004-01-16 06:29:43 UTC
Some of the info garnered from 71195:

When I was reproducing this, the error code returned was EAGAIN so the socket would block if we were actually to do a write that large. I remember Thiago saying that the kernel buffers for sockets are pretty large, so i don't think that would be the problem. 

Thiago (hi! :) : do you have any other suggestions or possibilities?
Comment 10 Thiago Macieira 2004-01-16 16:20:46 UTC
You marked this as duplicate, but I don't think it is the same bug.

This bug: don't use a buffered KExtendedSocket and, instead, buffer the queued up messages using a QValueList and send them on a timer or something. Make sure the socket is non-blocking and the EWOULDBLOCK errno not being an error. Even better would be to use a QSocketNotifier when the first EWOULDBLOCK error occurs -- so that you don't poll through write(2) unnecessarily.

That bug: it was a KExtendedSocket misfeature: a buffered socket can block. Easily solved with setBlockingMode(false).
Comment 11 Richard Smith 2004-02-07 19:49:11 UTC
Something needs to be per-account (or at the very least, per-protocol) about this. Since for SMS I want to send messages with the "Linked: n/m" headers that most modern phones support, I want to be able to say whether or not to do that. Also, how do people feel about splitting in the middle of / between words?
Comment 12 Olivier Goffart 2004-03-12 22:26:11 UTC
A method in libkopete should be added to count the number of char in a message.

*** This bug has been marked as a duplicate of 66202 ***