pidgin/plugins/history.c

changeset 26378
e85d894af8a5
parent 25880
05694862fe8b
child 32438
dc8991868906
child 37239
b4e5abab1114
equal deleted inserted replaced
26377:9124a345ed3a 26378:e85d894af8a5
60 * Otherwise, we might show a very old log. */ 60 * Otherwise, we might show a very old log. */
61 if (!purple_prefs_get_bool("/purple/logging/log_ims")) 61 if (!purple_prefs_get_bool("/purple/logging/log_ims"))
62 return; 62 return;
63 63
64 /* Find buddies for this conversation. */ 64 /* Find buddies for this conversation. */
65 buddies = purple_find_buddies(account, name); 65 buddies = purple_find_buddies(account, name);
66 66
67 /* If we found at least one buddy, save the first buddy's alias. */ 67 /* If we found at least one buddy, save the first buddy's alias. */
68 if (buddies != NULL) 68 if (buddies != NULL)
69 alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data); 69 alias = purple_buddy_get_contact_alias((PurpleBuddy *)buddies->data);
70 70
71 for (cur = buddies; cur != NULL; cur = cur->next) 71 for (cur = buddies; cur != NULL; cur = cur->next)
72 { 72 {
73 PurpleBlistNode *node = cur->data; 73 PurpleBlistNode *node = cur->data;
74 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) 74 PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node);
75 { 75 PurpleBlistNode *next = purple_blist_node_get_sibling_next(node);
76 if ((node != NULL) && ((prev != NULL) || (next != NULL)))
77 {
76 PurpleBlistNode *node2; 78 PurpleBlistNode *node2;
79 PurpleBlistNode *parent = purple_blist_node_get_parent(node);
80 PurpleBlistNode *child = purple_blist_node_get_first_child(parent);
77 81
78 alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); 82 alias = purple_buddy_get_contact_alias((PurpleBuddy *)node);
79 83
80 /* We've found a buddy that matches this conversation. It's part of a 84 /* We've found a buddy that matches this conversation. It's part of a
81 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies 85 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies
82 * in the contact and get all the logs. */ 86 * in the contact and get all the logs. */
83 for (node2 = node->parent->child ; node2 != NULL ; node2 = node2->next) 87 for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2))
84 { 88 {
85 logs = g_list_concat( 89 logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM,
86 purple_log_get_logs(PURPLE_LOG_IM,
87 purple_buddy_get_name((PurpleBuddy *)node2), 90 purple_buddy_get_name((PurpleBuddy *)node2),
88 purple_buddy_get_account((PurpleBuddy *)node2)), 91 purple_buddy_get_account((PurpleBuddy *)node2)),
89 logs); 92 logs);
90 } 93 }
91 break; 94 break;
92 } 95 }
93 } 96 }
94 g_slist_free(buddies); 97 g_slist_free(buddies);
95 98
96 if (logs == NULL) 99 if (logs == NULL)
97 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account); 100 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account);
98 else 101 else
99 logs = g_list_sort(logs, purple_log_compare); 102 logs = g_list_sort(logs, purple_log_compare);
116 if (flags & PURPLE_LOG_READ_NO_NEWLINE) 119 if (flags & PURPLE_LOG_READ_NO_NEWLINE)
117 options |= GTK_IMHTML_NO_NEWLINE; 120 options |= GTK_IMHTML_NO_NEWLINE;
118 121
119 protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml))); 122 protocol = g_strdup(gtk_imhtml_get_protocol_name(GTK_IMHTML(gtkconv->imhtml)));
120 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), 123 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
121 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account)); 124 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account));
122 125
123 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) 126 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml))))
124 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", options); 127 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", options);
125 128
126 escaped_alias = g_markup_escape_text(alias, -1); 129 escaped_alias = g_markup_escape_text(alias, -1);

mercurial