Mercurial > pidgin.yaz
comparison src/protocols/irc/irc.c @ 9440:00242c2419c3
[gaim-migrate @ 10261]
This should prevent any loops on connection errors for IRC
committer: Tailor Script <tailor@pidgin.im>
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Fri, 02 Jul 2004 03:54:14 +0000 |
parents | b3bda982996b |
children | eaa9aa1fad61 |
comparison
equal
deleted
inserted
replaced
9439:023adfccd524 | 9440:00242c2419c3 |
---|---|
80 gaim_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); | 80 gaim_notify_formatted(gc, title, title, NULL, irc->motd->str, NULL, NULL); |
81 } | 81 } |
82 | 82 |
83 int irc_send(struct irc_conn *irc, const char *buf) | 83 int irc_send(struct irc_conn *irc, const char *buf) |
84 { | 84 { |
85 int ret; | |
86 | |
85 if (irc->fd < 0) | 87 if (irc->fd < 0) |
86 return -1; | 88 return -1; |
87 | 89 |
88 /* gaim_debug(GAIM_DEBUG_MISC, "irc", "sent: %s", buf); */ | 90 /* gaim_debug(GAIM_DEBUG_MISC, "irc", "sent: %s", buf); */ |
89 return write(irc->fd, buf, strlen(buf)); | 91 if ((ret = write(irc->fd, buf, strlen(buf))) < 0) |
92 gaim_connection_error(gaim_account_get_connection(irc->account), | |
93 _("Server has disconnected")); | |
94 | |
95 return ret; | |
90 } | 96 } |
91 | 97 |
92 /* XXX I don't like messing directly with these buddies */ | 98 /* XXX I don't like messing directly with these buddies */ |
93 gboolean irc_blist_timeout(struct irc_conn *irc) | 99 gboolean irc_blist_timeout(struct irc_conn *irc) |
94 { | 100 { |
385 | 391 |
386 if ((len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1)) < 0) { | 392 if ((len = read(irc->fd, irc->inbuf + irc->inbufused, IRC_INITIAL_BUFSIZE - 1)) < 0) { |
387 gaim_connection_error(gc, _("Read error")); | 393 gaim_connection_error(gc, _("Read error")); |
388 return; | 394 return; |
389 } else if (len == 0) { | 395 } else if (len == 0) { |
390 /* Remote closed the connection, probably */ | 396 gaim_connection_error(gc, _("Server has disconnected")); |
391 return; | 397 return; |
392 } | 398 } |
393 | 399 |
394 irc->inbufused += len; | 400 irc->inbufused += len; |
395 irc->inbuf[irc->inbufused] = '\0'; | 401 irc->inbuf[irc->inbufused] = '\0'; |