Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EionRobb/skype4pidgin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEion Robb <eion@robbmob.com>2007-11-18 14:11:15 +0300
committerEion Robb <eion@robbmob.com>2007-11-18 14:11:15 +0300
commit195526d7981c977286cb450bf20f92658e1f557c (patch)
treeb9c5197fe8faa22b7c27bc426082ff9d255fcc3d /skype_messaging_x11.c
parentd3032e51e0ca67046fa10808ae6830a03b713c2d (diff)
Diffstat (limited to 'skype_messaging_x11.c')
-rw-r--r--skype_messaging_x11.c60
1 files changed, 27 insertions, 33 deletions
diff --git a/skype_messaging_x11.c b/skype_messaging_x11.c
index 1a12401..ab4d85b 100644
--- a/skype_messaging_x11.c
+++ b/skype_messaging_x11.c
@@ -6,13 +6,13 @@ static Window win = (Window)-1;
Window skype_win = (Window)-1;
GThread *receiving_thread;
Atom message_start, message_continue;
-static gboolean run_loop = TRUE;
+static gboolean run_loop = TRUE;
static unsigned char x11_error_code = 0;
-static void receive_message_loop(void);
+static void receive_message_loop(void);
int x11_error_handler(Display *disp, XErrorEvent *error);
-static gboolean
+static gboolean
skype_connect()
{
Window root;
@@ -60,7 +60,7 @@ skype_connect()
}
-static void
+static void
skype_disconnect()
{
XEvent e;
@@ -73,21 +73,21 @@ skype_disconnect()
e.xclient.type = DestroyNotify;
XSendEvent(disp, win, False, 0, &e);
XDestroyWindow(disp, win);
- XCloseDisplay(disp);
-
- win = (Window)-1;
+ XCloseDisplay(disp);
+
+ win = (Window)-1;
disp = NULL;
-}
-
-int
-x11_error_handler(Display *disp, XErrorEvent *error)
-{
- x11_error_code = error->error_code;
- return FALSE;
+}
+
+int
+x11_error_handler(Display *disp, XErrorEvent *error)
+{
+ x11_error_code = error->error_code;
+ return FALSE;
}
-static void
+static void
send_message(char* message)
{
unsigned int pos = 0;
@@ -116,7 +116,7 @@ send_message(char* message)
e.xclient.display = disp;
e.xclient.window = win;
e.xclient.format = 8; /* 8-bit values */
-
+
XSetErrorHandler(x11_error_handler);
do
{
@@ -128,10 +128,10 @@ send_message(char* message)
pos += i;
} while( pos <= len );
- XFlush(disp);
-
- if (x11_error_code == BadWindow)
- {
+ XFlush(disp);
+
+ if (x11_error_code == BadWindow)
+ {
//There was an error
if (message[0] == '#')
{
@@ -139,29 +139,27 @@ send_message(char* message)
sscanf(message, "#%d ", &message_num);
sprintf(error_return, "#%d ERROR", message_num);
g_thread_create((GThreadFunc)skype_message_received, (void *)g_strdup(error_return), FALSE, NULL);
- }
+ }
g_thread_create((GThreadFunc)skype_message_received, "CONNSTATUS LOGGEDOUT", FALSE, NULL);
- return;
+ return;
}
}
-static void
+static void
receive_message_loop(void)
{
XEvent e;
GString *msg = NULL;
char msg_temp[21];
- int last_len, real_len;
+ int last_len, real_len;
msg_temp[21] = '\0';
while(run_loop)
- {
- XPeekEvent(disp, &e);
- //XNextEvent(disp, &e);
+ {
+ XNextEvent(disp, &e);
if (e.type != ClientMessage)
{
purple_debug_info("skype_x11", "Unknown event received: %d\n", e.xclient.type);
- //XPutBackEvent(disp, &e);
XFlush(disp);
continue;
}
@@ -178,18 +176,14 @@ receive_message_loop(void)
msg = g_string_append_len(msg, msg_temp, real_len);
else
{
- //XPutBackEvent(disp, &e);
XFlush(disp);
continue;
- }
-
- XNextEvent(disp, &e);
+ }
if (last_len < 21)
{
g_thread_create((GThreadFunc)skype_message_received, (void *)g_strdup(msg->str), FALSE, NULL);
XFlush(disp);
- usleep(500);
}
}
}