| 119 } |
119 } |
| 120 |
120 |
| 121 int irc_send_len(struct irc_conn *irc, const char *buf, int buflen) |
121 int irc_send_len(struct irc_conn *irc, const char *buf, int buflen) |
| 122 { |
122 { |
| 123 char *tosend= g_strdup(buf); |
123 char *tosend= g_strdup(buf); |
| |
124 int len; |
| 124 GBytes *data; |
125 GBytes *data; |
| 125 |
126 |
| 126 purple_signal_emit(_irc_protocol, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); |
127 purple_signal_emit(_irc_protocol, "irc-sending-text", purple_account_get_connection(irc->account), &tosend); |
| 127 |
128 |
| 128 if (tosend == NULL) |
129 if (tosend == NULL) |
| 129 return 0; |
130 return 0; |
| 130 |
131 |
| 131 data = g_bytes_new_take(tosend, strlen(tosend)); |
132 len = strlen(tosend); |
| |
133 data = g_bytes_new_take(tosend, len); |
| 132 purple_queued_output_stream_push_bytes(irc->output, data); |
134 purple_queued_output_stream_push_bytes(irc->output, data); |
| 133 g_bytes_unref(data); |
135 g_bytes_unref(data); |
| 134 |
136 |
| 135 if (!g_output_stream_has_pending(G_OUTPUT_STREAM(irc->output))) { |
137 if (!g_output_stream_has_pending(G_OUTPUT_STREAM(irc->output))) { |
| 136 /* Connection idle. Flush data. */ |
138 /* Connection idle. Flush data. */ |
| 138 G_PRIORITY_DEFAULT, irc->cancellable, |
140 G_PRIORITY_DEFAULT, irc->cancellable, |
| 139 irc_flush_cb, |
141 irc_flush_cb, |
| 140 purple_account_get_connection(irc->account)); |
142 purple_account_get_connection(irc->account)); |
| 141 } |
143 } |
| 142 |
144 |
| 143 return strlen(tosend); |
145 return len; |
| 144 } |
146 } |
| 145 |
147 |
| 146 /* XXX I don't like messing directly with these buddies */ |
148 /* XXX I don't like messing directly with these buddies */ |
| 147 gboolean irc_blist_timeout(struct irc_conn *irc) |
149 gboolean irc_blist_timeout(struct irc_conn *irc) |
| 148 { |
150 { |