| 192 } |
192 } |
| 193 |
193 |
| 194 static gboolean |
194 static gboolean |
| 195 message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
195 message_send_cb(GtkWidget *widget, GdkEventKey *event, gpointer p) |
| 196 { |
196 { |
| 197 PurplePluginProtocolInfo *prpl_info = NULL; |
197 PurpleProtocol *protocol = NULL; |
| 198 PurpleConnection *gc; |
198 PurpleConnection *gc; |
| 199 gchar *text; |
199 gchar *text; |
| 200 |
200 |
| 201 if (event->keyval != GDK_KEY_KP_Enter && event->keyval != GDK_KEY_Return) |
201 if (event->keyval != GDK_KEY_KP_Enter && event->keyval != GDK_KEY_Return) |
| 202 return FALSE; |
202 return FALSE; |
| 203 |
203 |
| 204 gc = console->gc; |
204 gc = console->gc; |
| 205 |
205 |
| 206 if (gc) |
206 if (gc) |
| 207 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc)); |
207 protocol = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_protocol_info(gc)); |
| 208 |
208 |
| 209 text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); |
209 text = gtk_webview_get_body_text(GTK_WEBVIEW(widget)); |
| 210 |
210 |
| 211 if (prpl_info && prpl_info->send_raw != NULL) |
211 if (protocol && protocol->send_raw != NULL) |
| 212 prpl_info->send_raw(gc, text, strlen(text)); |
212 protocol->send_raw(gc, text, strlen(text)); |
| 213 |
213 |
| 214 g_free(text); |
214 g_free(text); |
| 215 gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); |
215 gtk_webview_load_html_string(GTK_WEBVIEW(console->entry), ""); |
| 216 |
216 |
| 217 return TRUE; |
217 return TRUE; |