comparison src/protocols/jabber/jabber.c @ 6076:8d6aa792e0f6

[gaim-migrate @ 6535] make the jabber error code, and the core error code more betterer. this should fix luke's problem with downed jabber servers committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Thu, 10 Jul 2003 18:56:52 +0000
parents d8cd876e613e
children 99f4bbeb27bc
comparison
equal deleted inserted replaced
6075:f7ddc1f6227e 6076:8d6aa792e0f6
549 549
550 static void gjab_send(gjconn gjc, xmlnode x) 550 static void gjab_send(gjconn gjc, xmlnode x)
551 { 551 {
552 if (gjc && gjc->state != JCONN_STATE_OFF) { 552 if (gjc && gjc->state != JCONN_STATE_OFF) {
553 char *buf = xmlnode2str(x); 553 char *buf = xmlnode2str(x);
554 if (buf) 554 if (buf) {
555 #ifndef _WIN32 555 #ifndef _WIN32
556 write(gjc->fd, buf, strlen(buf)); 556 if(write(gjc->fd, buf, strlen(buf)) < 0) {
557 #else 557 #else
558 send(gjc->fd, buf, strlen(buf), 0); 558 if(send(gjc->fd, buf, strlen(buf), 0) < 0) {
559 #endif 559 #endif
560 gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send: %s\n", buf); 560 gaim_connection_error(GJ_GC(gjc), _("Write error"));
561 } else {
562 gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send: %s\n", buf);
563 }
564 }
561 } 565 }
562 } 566 }
563 567
564 static void gjab_send_raw(gjconn gjc, const char *str) 568 static void gjab_send_raw(gjconn gjc, const char *str)
565 { 569 {
570 #ifndef _WIN32 574 #ifndef _WIN32
571 if(write(gjc->fd, str, strlen(str)) < 0) { 575 if(write(gjc->fd, str, strlen(str)) < 0) {
572 #else 576 #else
573 if(send(gjc->fd, str, strlen(str), 0) < 0) { 577 if(send(gjc->fd, str, strlen(str), 0) < 0) {
574 #endif 578 #endif
575 fprintf(stderr, "DBG: Problem sending. Error: %d\n", errno); 579 gaim_connection_error(GJ_GC(gjc), _("Write error"));
576 fflush(stderr);
577 } 580 }
578 /* printing keepalives to the debug window is really annoying */ 581 /* printing keepalives to the debug window is really annoying */
579 if(strcmp(str, JABBER_KEEPALIVE_STRING)) 582 if(strcmp(str, JABBER_KEEPALIVE_STRING))
580 gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send_raw: %s\n", str); 583 gaim_debug(GAIM_DEBUG_MISC, "jabber", "gjab_send_raw: %s\n", str);
581 } 584 }