mirror of
https://github.com/irssi/irssi.git
synced 2026-08-24 02:52:20 +02:00
Add OTR Support to Irssi
Major thanks to the original authors of Irssi-OTR: Uli Meis and David Goulet. Thanks to the OTR community in #OTR on OFTC, thanks to everyone who have helped testing the patches and submitted UI suggestions.
This commit is contained in:
parent
1c6695107c
commit
c2a2d3544f
25 changed files with 3281 additions and 40 deletions
|
|
@ -45,6 +45,39 @@ GIOChannel *g_io_channel_new(int handle)
|
|||
return chan;
|
||||
}
|
||||
|
||||
int g_io_channel_write_block(GIOChannel *channel, void *data, int len)
|
||||
{
|
||||
gsize ret;
|
||||
int sent;
|
||||
GIOStatus status;
|
||||
|
||||
sent = 0;
|
||||
do {
|
||||
status = g_io_channel_write_chars(channel, (char *) data + sent, len - sent, &ret, NULL);
|
||||
sent += ret;
|
||||
} while (sent < len && status != G_IO_STATUS_ERROR);
|
||||
|
||||
return sent < len ? -1 : 0;
|
||||
}
|
||||
|
||||
int g_io_channel_read_block(GIOChannel *channel, void *data, int len)
|
||||
{
|
||||
time_t maxwait;
|
||||
gsize ret;
|
||||
int received;
|
||||
GIOStatus status;
|
||||
|
||||
maxwait = time(NULL)+2;
|
||||
received = 0;
|
||||
do {
|
||||
status = g_io_channel_read_chars(channel, (char *) data + received, len - received, &ret, NULL);
|
||||
received += ret;
|
||||
} while (received < len && time(NULL) < maxwait &&
|
||||
status != G_IO_STATUS_ERROR && status != G_IO_STATUS_EOF);
|
||||
|
||||
return received < len ? -1 : 0;
|
||||
}
|
||||
|
||||
/* Cygwin need this, don't know others.. */
|
||||
/*#define BLOCKING_SOCKETS 1*/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue