Go to the source code of this file.
Functions | |
int | linemode_on (int idx) |
Turns linebuffering on an index on. | |
int | linemode_off (int idx) |
Turns linebuffering on an index off. | |
int | linemode_check (int idx) |
Checks if an index is in linebuffered mode. |
int linemode_check | ( | int | idx | ) |
Checks if an index is in linebuffered mode.
idx | the index to check |
Definition at line 180 of file linemode.c.
References sockbuf_get_filter_data(), and sockbuf_isvalid().
Referenced by linemode_on(), and script_net_linemode().
00181 { 00182 if (!sockbuf_isvalid(idx)) return -1; 00183 return !sockbuf_get_filter_data(idx, &linemode_filter, 0); 00184 }
int linemode_off | ( | int | idx | ) |
Turns linebuffering on an index off.
If there if a line currently buffered it's send of immidiatly.
idx | the index to turn off linebuffering for |
Definition at line 152 of file linemode.c.
References linemode_t::data, linemode_t::len, LINEMODE_LEVEL, sockbuf_detach_filter(), and sockbuf_on_read().
Referenced by script_net_linemode().
00153 { 00154 int ret; 00155 linemode_t *old_data; 00156 00157 ret = sockbuf_detach_filter(idx, &linemode_filter, &old_data); 00158 if (ret) return ret; 00159 if (old_data) { 00160 if (old_data->data) { 00161 if (old_data->len) { 00162 old_data->data[old_data->len] = 0; 00163 sockbuf_on_read(idx, LINEMODE_LEVEL, old_data->data, old_data->len); 00164 old_data->len = 0; 00165 } 00166 free(old_data->data); 00167 } 00168 free(old_data); 00169 } 00170 return(0); 00171 }
int linemode_on | ( | int | idx | ) |
Turns linebuffering on an index on.
idx | the index to turn on linebuffering for |
Definition at line 133 of file linemode.c.
References linemode_check(), and sockbuf_attach_filter().
Referenced by do_link(), got_chat_request(), http_reconnect(), irc_on_newclient(), script_net_linemode(), server_on_connect(), telnet_on_newclient(), and terminal_init().
00134 { 00135 linemode_t *old_data; 00136 00137 if (linemode_check(idx)) return -1; 00138 old_data = calloc(1, sizeof(*old_data)); 00139 sockbuf_attach_filter(idx, &linemode_filter, old_data); 00140 return(0); 00141 }