comparison src/buddy_chat.c @ 2368:84823e04dcf7

[gaim-migrate @ 2381] i finally fixed this. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 27 Sep 2001 06:04:59 +0000
parents 0264a8a27e69
children db02399a9ad7
comparison
equal deleted inserted replaced
2367:6c4ec021c998 2368:84823e04dcf7
1108 } 1108 }
1109 1109
1110 void chat_set_topic(struct conversation *b, char* who, char* topic) 1110 void chat_set_topic(struct conversation *b, char* who, char* topic)
1111 { 1111 {
1112 gtk_entry_set_text(GTK_ENTRY(b->topic_text), topic); 1112 gtk_entry_set_text(GTK_ENTRY(b->topic_text), topic);
1113 if (b->topic)
1114 g_free(b->topic);
1115 b->topic = g_strdup(topic);
1113 } 1116 }
1114 1117
1115 1118
1116 1119
1117 void delete_chat(struct conversation *b) 1120 void delete_chat(struct conversation *b)
1123 while (b->ignored) { 1126 while (b->ignored) {
1124 g_free(b->ignored->data); 1127 g_free(b->ignored->data);
1125 b->ignored = g_list_remove(b->ignored, b->ignored->data); 1128 b->ignored = g_list_remove(b->ignored, b->ignored->data);
1126 } 1129 }
1127 g_string_free(b->history, TRUE); 1130 g_string_free(b->history, TRUE);
1131 if (b->topic)
1132 g_free(b->topic);
1128 g_free(b); 1133 g_free(b);
1129 } 1134 }
1130 1135
1131 static GtkWidget *change_text(GtkWidget *win, char *text, GtkWidget *button, char **xpm, int chat) 1136 static GtkWidget *change_text(GtkWidget *win, char *text, GtkWidget *button, char **xpm, int chat)
1132 { 1137 {
1217 } 1222 }
1218 } 1223 }
1219 1224
1220 void chat_tabize() 1225 void chat_tabize()
1221 { 1226 {
1227 int pos = 0;
1222 /* evil, evil i tell you! evil! */ 1228 /* evil, evil i tell you! evil! */
1223 if (chat_options & OPT_CHAT_ONE_WINDOW) { 1229 if (chat_options & OPT_CHAT_ONE_WINDOW) {
1224 GList *x = chats; 1230 GList *x = chats;
1225 while (x) { 1231 while (x) {
1226 struct conversation *c = x->data; 1232 struct conversation *c = x->data;
1227 GtkWidget *imhtml, *win; 1233 GtkWidget *imhtml, *win;
1234 GList *r = c->in_room;
1228 1235
1229 imhtml = c->text; 1236 imhtml = c->text;
1230 win = c->window; 1237 win = c->window;
1231 show_new_buddy_chat(c); 1238 show_new_buddy_chat(c);
1232 gtk_widget_destroy(c->text); 1239 gtk_widget_destroy(c->text);
1234 c->text = imhtml; 1241 c->text = imhtml;
1235 gtk_signal_disconnect_by_func(GTK_OBJECT(win), 1242 gtk_signal_disconnect_by_func(GTK_OBJECT(win),
1236 GTK_SIGNAL_FUNC(close_callback), c); 1243 GTK_SIGNAL_FUNC(close_callback), c);
1237 gtk_widget_destroy(win); 1244 gtk_widget_destroy(win);
1238 1245
1246 if (c->topic)
1247 gtk_entry_set_text(GTK_ENTRY(c->topic_text), c->topic);
1248
1249 while (r) {
1250 char *name = r->data;
1251 GtkWidget *list_item;
1252 GList *ignored = c->ignored;
1253 char tmp[BUF_LONG];
1254
1255 while (ignored) {
1256 if (!g_strcasecmp(name, ignored->data))
1257 break;
1258 ignored = ignored->next;
1259 }
1260
1261 if (ignored) {
1262 g_snprintf(tmp, sizeof(tmp), "X %s", name);
1263 list_item = gtk_list_item_new_with_label(tmp);
1264 } else
1265 list_item = gtk_list_item_new_with_label(name);
1266
1267 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
1268 gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event",
1269 GTK_SIGNAL_FUNC(right_click_chat), c);
1270 gtk_list_insert_items(GTK_LIST(c->list),
1271 g_list_append(NULL, list_item), pos);
1272 gtk_widget_show(list_item);
1273
1274 r = r->next;
1275 pos++;
1276 }
1277
1239 x = x->next; 1278 x = x->next;
1240 } 1279 }
1241 } else { 1280 } else {
1242 GList *x, *m; 1281 GList *x, *m;
1243 x = m = chats; 1282 x = m = chats;
1244 chats = NULL; 1283 chats = NULL;
1245 while (x) { 1284 while (x) {
1246 struct conversation *c = x->data; 1285 struct conversation *c = x->data;
1247 GtkWidget *imhtml; 1286 GtkWidget *imhtml;
1287 GList *r = c->in_room;
1248 1288
1249 imhtml = c->text; 1289 imhtml = c->text;
1250 show_new_buddy_chat(c); 1290 show_new_buddy_chat(c);
1251 gtk_widget_destroy(c->text); 1291 gtk_widget_destroy(c->text);
1252 gtk_widget_reparent(imhtml, c->sw); 1292 gtk_widget_reparent(imhtml, c->sw);
1253 c->text = imhtml; 1293 c->text = imhtml;
1294
1295 if (c->topic)
1296 gtk_entry_set_text(GTK_ENTRY(c->topic_text), c->topic);
1297
1298 while (r) {
1299 char *name = r->data;
1300 GtkWidget *list_item;
1301 GList *ignored = c->ignored;
1302 char tmp[BUF_LONG];
1303
1304 while (ignored) {
1305 if (!g_strcasecmp(name, ignored->data))
1306 break;
1307 ignored = ignored->next;
1308 }
1309
1310 if (ignored) {
1311 g_snprintf(tmp, sizeof(tmp), "X %s", name);
1312 list_item = gtk_list_item_new_with_label(tmp);
1313 } else
1314 list_item = gtk_list_item_new_with_label(name);
1315
1316 gtk_object_set_user_data(GTK_OBJECT(list_item), name);
1317 gtk_signal_connect(GTK_OBJECT(list_item), "button_press_event",
1318 GTK_SIGNAL_FUNC(right_click_chat), c);
1319 gtk_list_insert_items(GTK_LIST(c->list),
1320 g_list_append(NULL, list_item), pos);
1321 gtk_widget_show(list_item);
1322
1323 r = r->next;
1324 pos++;
1325 }
1254 1326
1255 x = x->next; 1327 x = x->next;
1256 } 1328 }
1257 if (all_chats) 1329 if (all_chats)
1258 gtk_widget_destroy(all_chats); 1330 gtk_widget_destroy(all_chats);