pidgin/plugins/history.c

branch
next.minor
changeset 25880
05694862fe8b
parent 24990
e2fdc2cd23a4
child 32438
dc8991868906
child 37239
b4e5abab1114
equal deleted inserted replaced
25879:c062ffc658b8 25880:05694862fe8b
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 PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node); 74 PurpleBlistNode *prev = purple_blist_node_get_sibling_prev(node);
75 PurpleBlistNode *next = purple_blist_node_get_sibling_next(node); 75 PurpleBlistNode *next = purple_blist_node_get_sibling_next(node);
76 if ((node != NULL) && ((prev != NULL) || (next != NULL))) 76 if ((node != NULL) && ((prev != NULL) || (next != NULL)))
77 { 77 {
78 PurpleBlistNode *node2; 78 PurpleBlistNode *node2;
79 PurpleBlistNode *parent = purple_blist_node_get_parent(node); 79 PurpleBlistNode *parent = purple_blist_node_get_parent(node);
80 PurpleBlistNode *child = purple_blist_node_get_first_child(parent); 80 PurpleBlistNode *child = purple_blist_node_get_first_child(parent);
81 81
82 alias = purple_buddy_get_contact_alias((PurpleBuddy *)node); 82 alias = purple_buddy_get_contact_alias((PurpleBuddy *)node);
84 /* 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
85 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies 85 * PurpleContact with more than one PurpleBuddy. Loop through the PurpleBuddies
86 * in the contact and get all the logs. */ 86 * in the contact and get all the logs. */
87 for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2)) 87 for (node2 = child ; node2 != NULL ; node2 = purple_blist_node_get_sibling_next(node2))
88 { 88 {
89 logs = g_list_concat( 89 logs = g_list_concat(purple_log_get_logs(PURPLE_LOG_IM,
90 purple_log_get_logs(PURPLE_LOG_IM,
91 purple_buddy_get_name((PurpleBuddy *)node2), 90 purple_buddy_get_name((PurpleBuddy *)node2),
92 purple_buddy_get_account((PurpleBuddy *)node2)), 91 purple_buddy_get_account((PurpleBuddy *)node2)),
93 logs); 92 logs);
94 } 93 }
95 break; 94 break;
96 } 95 }
97 } 96 }
98 g_slist_free(buddies); 97 g_slist_free(buddies);
99 98
100 if (logs == NULL) 99 if (logs == NULL)
101 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account); 100 logs = purple_log_get_logs(PURPLE_LOG_IM, name, account);
102 else 101 else
103 logs = g_list_sort(logs, purple_log_compare); 102 logs = g_list_sort(logs, purple_log_compare);
120 if (flags & PURPLE_LOG_READ_NO_NEWLINE) 119 if (flags & PURPLE_LOG_READ_NO_NEWLINE)
121 options |= GTK_IMHTML_NO_NEWLINE; 120 options |= GTK_IMHTML_NO_NEWLINE;
122 121
123 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)));
124 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), 123 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml),
125 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account)); 124 purple_account_get_protocol_name(((PurpleLog*)logs->data)->account));
126 125
127 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))))
128 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", options); 127 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", options);
129 128
130 escaped_alias = g_markup_escape_text(alias, -1); 129 escaped_alias = g_markup_escape_text(alias, -1);

mercurial