| 113 { |
113 { |
| 114 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
114 const char *text = gnt_entry_get_text(GNT_ENTRY(ggconv->entry)); |
| 115 gboolean empty = (!text || !*text || (*text == '/')); |
115 gboolean empty = (!text || !*text || (*text == '/')); |
| 116 if (purple_prefs_get_bool("/finch/conversations/notify_typing")) { |
116 if (purple_prefs_get_bool("/finch/conversations/notify_typing")) { |
| 117 PurpleConversation *conv = ggconv->active_conv; |
117 PurpleConversation *conv = ggconv->active_conv; |
| 118 PurpleConvIm *im = PURPLE_CONV_IM(conv); |
118 PurpleIMConversation *im = PURPLE_CONV_IM(conv); |
| 119 if (!empty) { |
119 if (!empty) { |
| 120 gboolean send = (purple_conv_im_get_send_typed_timeout(im) == 0); |
120 gboolean send = (purple_im_conversation_get_send_typed_timeout(im) == 0); |
| 121 |
121 |
| 122 purple_conv_im_stop_send_typed_timeout(im); |
122 purple_im_conversation_stop_send_typed_timeout(im); |
| 123 purple_conv_im_start_send_typed_timeout(im); |
123 purple_im_conversation_start_send_typed_timeout(im); |
| 124 if (send || (purple_conv_im_get_type_again(im) != 0 && |
124 if (send || (purple_im_conversation_get_type_again(im) != 0 && |
| 125 time(NULL) > purple_conv_im_get_type_again(im))) { |
125 time(NULL) > purple_im_conversation_get_type_again(im))) { |
| 126 unsigned int timeout; |
126 unsigned int timeout; |
| 127 timeout = serv_send_typing(purple_conversation_get_connection(conv), |
127 timeout = serv_send_typing(purple_conversation_get_connection(conv), |
| 128 purple_conversation_get_name(conv), |
128 purple_conversation_get_name(conv), |
| 129 PURPLE_TYPING); |
129 PURPLE_IM_CONVERSATION_TYPING); |
| 130 purple_conv_im_set_type_again(im, timeout); |
130 purple_im_conversation_set_type_again(im, timeout); |
| 131 } |
131 } |
| 132 } else { |
132 } else { |
| 133 purple_conv_im_stop_send_typed_timeout(im); |
133 purple_im_conversation_stop_send_typed_timeout(im); |
| 134 |
134 |
| 135 serv_send_typing(purple_conversation_get_connection(conv), |
135 serv_send_typing(purple_conversation_get_connection(conv), |
| 136 purple_conversation_get_name(conv), |
136 purple_conversation_get_name(conv), |
| 137 PURPLE_NOT_TYPING); |
137 PURPLE_IM_CONVERSATION_NOT_TYPING); |
| 138 } |
138 } |
| 139 } |
139 } |
| 140 } |
140 } |
| 141 |
141 |
| 142 static void |
142 static void |
| 195 { |
195 { |
| 196 char *escape = purple_markup_escape_text((*text == '/' ? text + 1 : text), -1); |
196 char *escape = purple_markup_escape_text((*text == '/' ? text + 1 : text), -1); |
| 197 switch (purple_conversation_get_type(ggconv->active_conv)) |
197 switch (purple_conversation_get_type(ggconv->active_conv)) |
| 198 { |
198 { |
| 199 case PURPLE_CONV_TYPE_IM: |
199 case PURPLE_CONV_TYPE_IM: |
| 200 purple_conv_im_send_with_flags(PURPLE_CONV_IM(ggconv->active_conv), escape, PURPLE_MESSAGE_SEND); |
200 purple_im_conversation_send_message(PURPLE_CONV_IM(ggconv->active_conv), escape, PURPLE_MESSAGE_SEND); |
| 201 break; |
201 break; |
| 202 case PURPLE_CONV_TYPE_CHAT: |
202 case PURPLE_CONV_TYPE_CHAT: |
| 203 purple_conv_chat_send(PURPLE_CONV_CHAT(ggconv->active_conv), escape); |
203 purple_chat_conversation_send(PURPLE_CONV_CHAT(ggconv->active_conv), escape); |
| 204 break; |
204 break; |
| 205 default: |
205 default: |
| 206 g_free(escape); |
206 g_free(escape); |
| 207 g_return_if_reached(); |
207 g_return_if_reached(); |
| 208 } |
208 } |
| 272 static void |
272 static void |
| 273 update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
273 update_buddy_typing(PurpleAccount *account, const char *who, gpointer null) |
| 274 { |
274 { |
| 275 PurpleConversation *conv; |
275 PurpleConversation *conv; |
| 276 FinchConv *ggc; |
276 FinchConv *ggc; |
| 277 PurpleConvIm *im = NULL; |
277 PurpleIMConversation *im = NULL; |
| 278 char *title, *str; |
278 char *title, *str; |
| 279 |
279 |
| 280 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
280 conv = purple_conversations_find_with_account(PURPLE_CONV_TYPE_IM, who, account); |
| 281 |
281 |
| 282 if (!conv) |
282 if (!conv) |
| 283 return; |
283 return; |
| 284 |
284 |
| 285 im = PURPLE_CONV_IM(conv); |
285 im = PURPLE_CONV_IM(conv); |
| 286 ggc = FINCH_CONV(conv); |
286 ggc = FINCH_CONV(conv); |
| 287 |
287 |
| 288 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { |
288 if (purple_im_conversation_get_typing_state(im) == PURPLE_IM_CONVERSATION_TYPING) { |
| 289 int scroll; |
289 int scroll; |
| 290 str = get_conversation_title(conv, account); |
290 str = get_conversation_title(conv, account); |
| 291 title = g_strdup_printf(_("%s [%s]"), str, |
291 title = g_strdup_printf(_("%s [%s]"), str, |
| 292 gnt_ascii_only() ? "T" : "\342\243\277"); |
292 gnt_ascii_only() ? "T" : "\342\243\277"); |
| 293 g_free(str); |
293 g_free(str); |
| 368 } |
368 } |
| 369 |
369 |
| 370 static void |
370 static void |
| 371 account_signing_off(PurpleConnection *gc) |
371 account_signing_off(PurpleConnection *gc) |
| 372 { |
372 { |
| 373 GList *list = purple_get_chats(); |
373 GList *list = purple_conversations_get_chats(); |
| 374 PurpleAccount *account = purple_connection_get_account(gc); |
374 PurpleAccount *account = purple_connection_get_account(gc); |
| 375 |
375 |
| 376 /* We are about to sign off. See which chats we are currently in, and mark |
376 /* We are about to sign off. See which chats we are currently in, and mark |
| 377 * them for rejoin on reconnect. */ |
377 * them for rejoin on reconnect. */ |
| 378 while (list) { |
378 while (list) { |
| 379 PurpleConversation *conv = list->data; |
379 PurpleConversation *conv = list->data; |
| 380 if (!purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) && |
380 if (!purple_chat_conversation_has_left(PURPLE_CONV_CHAT(conv)) && |
| 381 purple_conversation_get_account(conv) == account) { |
381 purple_conversation_get_account(conv) == account) { |
| 382 purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); |
382 purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE)); |
| 383 purple_conversation_write(conv, NULL, _("The account has disconnected and you are no " |
383 purple_conversation_write(conv, NULL, _("The account has disconnected and you are no " |
| 384 "longer in this chat. You will be automatically rejoined in the chat when " |
384 "longer in this chat. You will be automatically rejoined in the chat when " |
| 385 "the account reconnects."), |
385 "the account reconnects."), |
| 1041 if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR)) |
1041 if (flags & (PURPLE_MESSAGE_RECV | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_ERROR)) |
| 1042 gnt_widget_set_urgent(ggconv->tv); |
1042 gnt_widget_set_urgent(ggconv->tv); |
| 1043 if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) { |
1043 if (flags & PURPLE_MESSAGE_RECV && !gnt_widget_has_focus(ggconv->window)) { |
| 1044 int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")); |
1044 int count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")); |
| 1045 purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1)); |
1045 purple_conversation_set_data(conv, "unseen-count", GINT_TO_POINTER(count + 1)); |
| 1046 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
1046 purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_UNSEEN); |
| 1047 } |
1047 } |
| 1048 } |
1048 } |
| 1049 |
1049 |
| 1050 static void |
1050 static void |
| 1051 finch_write_chat(PurpleConversation *conv, const char *who, const char *message, |
1051 finch_write_chat(PurpleConversation *conv, const char *who, const char *message, |
| 1123 |
1123 |
| 1124 g_string_printf(string, |
1124 g_string_printf(string, |
| 1125 ngettext("List of %d user:\n", "List of %d users:\n", count), count); |
1125 ngettext("List of %d user:\n", "List of %d users:\n", count), count); |
| 1126 for (iter = users; iter; iter = iter->next) |
1126 for (iter = users; iter; iter = iter->next) |
| 1127 { |
1127 { |
| 1128 PurpleConvChatBuddy *cbuddy = iter->data; |
1128 PurpleChatConversationBuddy *cbuddy = iter->data; |
| 1129 const char *str; |
1129 const char *str; |
| 1130 |
1130 |
| 1131 if ((str = purple_conv_chat_cb_get_alias(cbuddy)) == NULL) |
1131 if ((str = purple_chat_conversation_cb_get_alias(cbuddy)) == NULL) |
| 1132 str = purple_conv_chat_cb_get_name(cbuddy); |
1132 str = purple_chat_conversation_cb_get_name(cbuddy); |
| 1133 g_string_append_printf(string, "[ %s ]", str); |
1133 g_string_append_printf(string, "[ %s ]", str); |
| 1134 } |
1134 } |
| 1135 |
1135 |
| 1136 purple_conversation_write(conv, NULL, string->str, |
1136 purple_conversation_write(conv, NULL, string->str, |
| 1137 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
1137 PURPLE_MESSAGE_SYSTEM, time(NULL)); |
| 1138 g_string_free(string, TRUE); |
1138 g_string_free(string, TRUE); |
| 1139 } |
1139 } |
| 1140 |
1140 |
| 1141 for (; users; users = users->next) |
1141 for (; users; users = users->next) |
| 1142 { |
1142 { |
| 1143 PurpleConvChatBuddy *cbuddy = users->data; |
1143 PurpleChatConversationBuddy *cbuddy = users->data; |
| 1144 GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
1144 GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
| 1145 gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_name(cbuddy)); |
1145 gnt_entry_add_suggest(entry, purple_chat_conversation_cb_get_name(cbuddy)); |
| 1146 gnt_entry_add_suggest(entry, purple_conv_chat_cb_get_alias(cbuddy)); |
1146 gnt_entry_add_suggest(entry, purple_chat_conversation_cb_get_alias(cbuddy)); |
| 1147 gnt_tree_add_row_after(tree, g_strdup(purple_conv_chat_cb_get_name(cbuddy)), |
1147 gnt_tree_add_row_after(tree, g_strdup(purple_chat_conversation_cb_get_name(cbuddy)), |
| 1148 gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cbuddy)), purple_conv_chat_cb_get_alias(cbuddy)), NULL, NULL); |
1148 gnt_tree_create_row(tree, chat_flag_text(purple_chat_conversation_cb_get_flags(cbuddy)), purple_chat_conversation_cb_get_alias(cbuddy)), NULL, NULL); |
| 1149 } |
1149 } |
| 1150 } |
1150 } |
| 1151 |
1151 |
| 1152 static void |
1152 static void |
| 1153 finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a) |
1153 finch_chat_rename_user(PurpleConversation *conv, const char *old, const char *new_n, const char *new_a) |
| 1154 { |
1154 { |
| 1155 /* Update the name for string completion */ |
1155 /* Update the name for string completion */ |
| 1156 FinchConv *ggc = FINCH_CONV(conv); |
1156 FinchConv *ggc = FINCH_CONV(conv); |
| 1157 GntEntry *entry = GNT_ENTRY(ggc->entry); |
1157 GntEntry *entry = GNT_ENTRY(ggc->entry); |
| 1158 GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
1158 GntTree *tree = GNT_TREE(ggc->u.chat->userlist); |
| 1159 PurpleConvChatBuddy *cb = purple_conv_chat_cb_find(PURPLE_CONV_CHAT(conv), new_n); |
1159 PurpleChatConversationBuddy *cb = purple_chat_conversation_cb_find(PURPLE_CONV_CHAT(conv), new_n); |
| 1160 |
1160 |
| 1161 gnt_entry_remove_suggest(entry, old); |
1161 gnt_entry_remove_suggest(entry, old); |
| 1162 gnt_tree_remove(tree, (gpointer)old); |
1162 gnt_tree_remove(tree, (gpointer)old); |
| 1163 |
1163 |
| 1164 gnt_entry_add_suggest(entry, new_n); |
1164 gnt_entry_add_suggest(entry, new_n); |
| 1165 gnt_entry_add_suggest(entry, new_a); |
1165 gnt_entry_add_suggest(entry, new_a); |
| 1166 gnt_tree_add_row_after(tree, g_strdup(new_n), |
1166 gnt_tree_add_row_after(tree, g_strdup(new_n), |
| 1167 gnt_tree_create_row(tree, chat_flag_text(purple_conv_chat_cb_get_flags(cb)), new_a), NULL, NULL); |
1167 gnt_tree_create_row(tree, chat_flag_text(purple_chat_conversation_cb_get_flags(cb)), new_a), NULL, NULL); |
| 1168 } |
1168 } |
| 1169 |
1169 |
| 1170 static void |
1170 static void |
| 1171 finch_chat_remove_users(PurpleConversation *conv, GList *list) |
1171 finch_chat_remove_users(PurpleConversation *conv, GList *list) |
| 1172 { |
1172 { |
| 1237 static PurpleCmdRet |
1237 static PurpleCmdRet |
| 1238 say_command_cb(PurpleConversation *conv, |
1238 say_command_cb(PurpleConversation *conv, |
| 1239 const char *cmd, char **args, char **error, void *data) |
1239 const char *cmd, char **args, char **error, void *data) |
| 1240 { |
1240 { |
| 1241 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
1241 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
| 1242 purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]); |
1242 purple_im_conversation_send(PURPLE_CONV_IM(conv), args[0]); |
| 1243 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
1243 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
| 1244 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), args[0]); |
1244 purple_chat_conversation_send(PURPLE_CONV_CHAT(conv), args[0]); |
| 1245 |
1245 |
| 1246 return PURPLE_CMD_RET_OK; |
1246 return PURPLE_CMD_RET_OK; |
| 1247 } |
1247 } |
| 1248 |
1248 |
| 1249 /* Xerox */ |
1249 /* Xerox */ |