Mercurial > pidgin
comparison console/gntconv.c @ 13886:90eb736b4c26
[gaim-migrate @ 16366]
Fix a typo ("chat" -> "conv"), plug a memory leak, and auto-scroll the
conversation history.
committer: Tailor Script <tailor@pidgin.im>
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 28 Jun 2006 16:01:42 +0000 |
parents | 582aaa4e287e |
children | 7d3256b253ec |
comparison
equal
deleted
inserted
replaced
13885:582aaa4e287e | 13886:90eb736b4c26 |
---|---|
132 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 132 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
133 name, GNT_TEXT_FLAG_BOLD); | 133 name, GNT_TEXT_FLAG_BOLD); |
134 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 134 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
135 strip, (flags & GAIM_MESSAGE_NICK) ? GNT_TEXT_FLAG_UNDERLINE : 0); | 135 strip, (flags & GAIM_MESSAGE_NICK) ? GNT_TEXT_FLAG_UNDERLINE : 0); |
136 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); | 136 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
137 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); | |
137 | 138 |
138 g_free(name); | 139 g_free(name); |
139 g_free(strip); | 140 g_free(strip); |
140 } | 141 } |
141 | 142 |
165 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 166 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
166 name, GNT_TEXT_FLAG_BOLD); | 167 name, GNT_TEXT_FLAG_BOLD); |
167 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 168 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
168 (strip = gaim_markup_strip_html(message)), 0); | 169 (strip = gaim_markup_strip_html(message)), 0); |
169 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); | 170 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
171 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); | |
172 | |
170 g_free(strip); | 173 g_free(strip); |
171 g_free(name); | 174 g_free(name); |
172 } | 175 } |
173 | 176 |
174 static void | 177 static void |
175 gg_write_conv(GaimConversation *conv, const char *who, const char *message, | 178 gg_write_conv(GaimConversation *conv, const char *who, const char *alias, |
176 GaimMessageFlags flags, time_t mtime) | 179 const char *message, GaimMessageFlags flags, time_t mtime) |
177 { | 180 { |
178 GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); | 181 GGConv *ggconv = g_hash_table_lookup(ggconvs, conv); |
179 char *strip; | 182 char *strip; |
180 char *name; | 183 char *name; |
181 | 184 |
182 g_return_if_fail(ggconv != NULL); | 185 g_return_if_fail(ggconv != NULL); |
183 | 186 |
184 strip = gaim_markup_strip_html(message); | 187 strip = gaim_markup_strip_html(message); |
185 name = g_strdup_printf("%s: ", who); | 188 if (alias && *alias) |
189 name = g_strdup_printf("%s: ", alias); | |
190 else if (who && *who) | |
191 name = g_strdup_printf("%s: ", who); | |
192 else | |
193 name = g_strdup(""); | |
186 | 194 |
187 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 195 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
188 name, GNT_TEXT_FLAG_BOLD); | 196 name, GNT_TEXT_FLAG_BOLD); |
189 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), | 197 gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(ggconv->tv), |
190 strip, 0); | 198 strip, 0); |
191 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); | 199 gnt_text_view_next_line(GNT_TEXT_VIEW(ggconv->tv)); |
200 gnt_text_view_scroll(GNT_TEXT_VIEW(ggconv->tv), 0); | |
192 | 201 |
193 g_free(strip); | 202 g_free(strip); |
203 g_free(name); | |
194 } | 204 } |
195 | 205 |
196 static void | 206 static void |
197 gg_chat_add_users(GaimConversation *conv, GList *users, GList *flags, GList *aliases, gboolean new_arrivals) | 207 gg_chat_add_users(GaimConversation *conv, GList *users, GList *flags, GList *aliases, gboolean new_arrivals) |
198 {} | 208 {} |
213 { | 223 { |
214 .create_conversation = gg_create_conversation, | 224 .create_conversation = gg_create_conversation, |
215 .destroy_conversation = gg_destroy_conversation, | 225 .destroy_conversation = gg_destroy_conversation, |
216 .write_chat = gg_write_chat, | 226 .write_chat = gg_write_chat, |
217 .write_im = gg_write_im, | 227 .write_im = gg_write_im, |
218 .write_chat = gg_write_conv, | 228 .write_conv = gg_write_conv, |
219 .chat_add_users = gg_chat_add_users, | 229 .chat_add_users = gg_chat_add_users, |
220 .chat_rename_user = gg_chat_rename_user, | 230 .chat_rename_user = gg_chat_rename_user, |
221 .chat_remove_users = gg_chat_remove_user, | 231 .chat_remove_users = gg_chat_remove_user, |
222 .chat_update_user = gg_chat_update_user, | 232 .chat_update_user = gg_chat_update_user, |
223 .present = NULL, | 233 .present = NULL, |