diff options
author | Eion Robb <eion@robbmob.com> | 2007-11-19 03:51:00 +0300 |
---|---|---|
committer | Eion Robb <eion@robbmob.com> | 2007-11-19 03:51:00 +0300 |
commit | 49d8850f33401955beb183d48678d91cfa970277 (patch) | |
tree | 93679f15e0ea689427cfe15872d8c2ed07e38059 /skype_messaging_x11.c | |
parent | b6f225d13be75fcac5611266b9ae1ffc73fc2f16 (diff) |
Fixed terrible logic in detecting x11 message ending
Diffstat (limited to 'skype_messaging_x11.c')
-rw-r--r-- | skype_messaging_x11.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/skype_messaging_x11.c b/skype_messaging_x11.c index 8c985e8..1947dbf 100644 --- a/skype_messaging_x11.c +++ b/skype_messaging_x11.c @@ -151,9 +151,9 @@ receive_message_loop(void) XEvent e;
GString *msg = NULL;
char msg_temp[21];
- size_t last_len, real_len;
+ size_t len;
- msg_temp[21] = '\0';
+ msg_temp[20] = '\0';
while(run_loop)
{
XNextEvent(disp, &e);
@@ -164,23 +164,18 @@ receive_message_loop(void) continue;
}
strncpy(msg_temp, e.xclient.data.b, 20);
- real_len = last_len = strlen(msg_temp);
- if (last_len >= 21)
- {
- last_len = 21;
- real_len = 20;
- }
+ len = strlen(msg_temp);
if (e.xclient.message_type == message_start)
- msg = g_string_new_len(msg_temp, real_len);
+ msg = g_string_new_len(msg_temp, len);
else if (e.xclient.message_type == message_continue)
- msg = g_string_append_len(msg, msg_temp, real_len);
+ msg = g_string_append_len(msg, msg_temp, len);
else
{
XFlush(disp);
continue;
}
- if (last_len < 21)
+ if (len < 20)
{
g_thread_create((GThreadFunc)skype_message_received, (void *)g_string_free(msg, FALSE), FALSE, NULL);
XFlush(disp);
|