static void close_offline_tabs_cb(GtkWidget *w, GObject *menu) { GList *iter; PidginConversation *gtkconv, *gconv; PidginWindow *win; PurpleConversation *purpconv; PurpleAccount *account; PurpleBuddy *buddy; gtkconv = g_object_get_data(menu, "clicked_tab"); if (!gtkconv) return; win = pidgin_conv_get_window(gtkconv); for (iter = pidgin_conv_window_get_gtkconvs(win); iter; ) { gconv = iter->data; iter = iter->next; purpconv = gconv->active_conv; account = purpconv->account; buddy = purple_find_buddy(account, purpconv->name); if(!PURPLE_BUDDY_IS_ONLINE(buddy)){ close_conv_cb(NULL, gconv); } } }
static void buddy_ticker_show(void) { PurpleBlistNode *gnode, *cnode, *bnode; PurpleBuddy *b; for(gnode = purple_blist_get_root(); gnode; gnode = purple_blist_node_get_sibling_next(gnode)) { if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) continue; for(cnode = purple_blist_node_get_first_child(gnode); cnode; cnode = purple_blist_node_get_sibling_next(cnode)) { if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) continue; for(bnode = purple_blist_node_get_first_child(cnode); bnode; bnode = purple_blist_node_get_sibling_next(bnode)) { if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) continue; b = (PurpleBuddy *)bnode; if(PURPLE_BUDDY_IS_ONLINE(b)) buddy_ticker_add_buddy(b); } } } }
static gint compare_onofflinetime(PurpleBlistNode *node1, PurpleBlistNode *node2) { PurpleBuddy *buddy1=NULL, *buddy2=NULL; int t1=0, t2=0; if(!node1) { return 0; } if(PURPLE_BLIST_NODE_IS_CHAT(node1) && PURPLE_BLIST_NODE_IS_CHAT(node2)) { return 0; } else if(PURPLE_BLIST_NODE_IS_CHAT(node1)) { return 1; } else if(PURPLE_BLIST_NODE_IS_CHAT(node2)) { return -1; } if(PURPLE_BLIST_NODE_IS_CONTACT(node1)) { buddy1 = purple_contact_get_priority_buddy((PurpleContact *)node1); } else if(PURPLE_BLIST_NODE_IS_BUDDY(node1)) { buddy1 = (PurpleBuddy *)node1; } if(PURPLE_BUDDY_IS_ONLINE(buddy1)) { t1 = purple_presence_get_login_time(purple_buddy_get_presence(buddy1)); } else { t1 = purple_blist_node_get_int((PurpleBlistNode *)buddy1, "last_seen"); } if(PURPLE_BLIST_NODE_IS_CONTACT(node2)) { buddy2 = purple_contact_get_priority_buddy((PurpleContact *)node2); } else if(PURPLE_BLIST_NODE_IS_BUDDY(node2)) { buddy2 = (PurpleBuddy *)node2; } if(PURPLE_BUDDY_IS_ONLINE(buddy2)) { t2 = purple_presence_get_login_time(purple_buddy_get_presence(buddy2)); } else { t2 = purple_blist_node_get_int((PurpleBlistNode *)buddy2, "last_seen"); } if(t1 > t2) { return -1; } if(t2 > t1) { return 1; } return 0; }
static gint compare_onoffline(PurpleBlistNode *node1, PurpleBlistNode *node2) { PurpleBuddy *buddy1=NULL, *buddy2=NULL; if(!node1) { return 0; } if(!node2) { return 0; } if(PURPLE_BLIST_NODE_IS_CHAT(node1) && PURPLE_BLIST_NODE_IS_CHAT(node2)) { return 0; } else if(PURPLE_BLIST_NODE_IS_CHAT(node1)) { return 1; } else if(PURPLE_BLIST_NODE_IS_CHAT(node2)) { return -1; } if(PURPLE_BLIST_NODE_IS_CONTACT(node1)) { buddy1 = purple_contact_get_priority_buddy((PurpleContact *)node1); } else if(PURPLE_BLIST_NODE_IS_BUDDY(node1)) { buddy1 = (PurpleBuddy *)node1; } if(PURPLE_BLIST_NODE_IS_CONTACT(node2)) { buddy2 = purple_contact_get_priority_buddy((PurpleContact *)node2); } else if(PURPLE_BLIST_NODE_IS_BUDDY(node2)) { buddy2 = (PurpleBuddy *)node2; } if(PURPLE_BUDDY_IS_ONLINE(buddy1)) { if(PURPLE_BUDDY_IS_ONLINE(buddy2)) { return 0; } else { return -1; } } else { if(PURPLE_BUDDY_IS_ONLINE(buddy2)) { return 1; } else { return 0; } } return 0; }
/*check if the msn user is online*/ gboolean msn_user_is_online(PurpleAccount *account, const char *name) { PurpleBuddy *buddy; buddy = purple_find_buddy(account, name); return PURPLE_BUDDY_IS_ONLINE(buddy); }
static void set_buddies_offline(PurpleBuddy *buddy, GSList *online_buddies_list) { if (g_slist_find(online_buddies_list, buddy) == NULL && PURPLE_BUDDY_IS_ONLINE(buddy)) { purple_prpl_got_user_status(buddy->account, buddy->name, purple_primitive_get_id_from_type(PURPLE_STATUS_OFFLINE), NULL); } }
static gpointer meebo_find_parent(PurpleBlistNode *node) { if (PURPLE_IS_CONTACT(node)) { PurpleBuddy *buddy = purple_contact_get_priority_buddy(PURPLE_CONTACT(node)); if (buddy && !PURPLE_BUDDY_IS_ONLINE(buddy)) { return &meebo; } } return default_manager->find_parent(node); }
void collect_buddies(PurpleBlistNode *p, std::vector<p_rest::Buddy> &list, bool online_only) { if (PURPLE_BLIST_NODE_IS_BUDDY(p)) { if (!online_only || (online_only && PURPLE_BUDDY_IS_ONLINE(PURPLE_BUDDY(p)))) { p_rest::Buddy new_buddy(PURPLE_BUDDY(p)->name); new_buddy.set_group(buddy_get_group_name(p).c_str()); if (PURPLE_BUDDY_IS_ONLINE(PURPLE_BUDDY(p))) { new_buddy.set_online_status(true); } list.push_back(new_buddy); } } if (p->child) { collect_buddies(p->child, list, online_only); } if (p->next) { collect_buddies(p->next, list, online_only); } }
static gpointer on_offline_find_parent(PurpleBlistNode *node) { gpointer ret = NULL; if (PURPLE_IS_CONTACT(node)) { node = PURPLE_BLIST_NODE(purple_contact_get_priority_buddy(PURPLE_CONTACT(node))); ret = PURPLE_BUDDY_IS_ONLINE(PURPLE_BUDDY(node)) ? online : offline; } else if (PURPLE_IS_BUDDY(node)) { ret = purple_blist_node_get_parent(node); finch_blist_manager_add_node(ret); } else if (PURPLE_IS_CHAT(node)) { ret = online; } return ret; }
gboolean ggp_edisc_xfer_can_receive_file(PurpleConnection *gc, const char *who) { PurpleBuddy *buddy; g_return_val_if_fail(gc != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); buddy = purple_blist_find_buddy(purple_connection_get_account(gc), who); if (buddy == NULL) return FALSE; /* TODO: check, if this buddy have us on his list */ return PURPLE_BUDDY_IS_ONLINE(buddy); }
static gboolean on_offline_can_add_node(PurpleBlistNode *node) { if (PURPLE_IS_CONTACT(node)) { PurpleContact *contact = PURPLE_CONTACT(node); if (purple_counting_node_get_current_size(PURPLE_COUNTING_NODE(contact)) > 0) return TRUE; return FALSE; } else if (PURPLE_IS_BUDDY(node)) { PurpleBuddy *buddy = PURPLE_BUDDY(node); if (PURPLE_BUDDY_IS_ONLINE(buddy)) return TRUE; if (purple_prefs_get_bool("/finch/blist/showoffline") && purple_account_is_connected(purple_buddy_get_account(buddy))) return TRUE; return FALSE; } else if (PURPLE_IS_CHAT(node)) { PurpleChat *chat = PURPLE_CHAT(node); return purple_account_is_connected(purple_chat_get_account(chat)); } return FALSE; }
void finch_pounce_editor_show(PurpleAccount *account, const char *name, PurplePounce *cur_pounce) { PurpleGntPounceDialog *dialog; GntWidget *window; GntWidget *bbox; GntWidget *hbox, *vbox; GntWidget *button; GntWidget *combo; GList *list; g_return_if_fail((cur_pounce != NULL) || (account != NULL) || (purple_accounts_get_all() != NULL)); dialog = g_new0(PurpleGntPounceDialog, 1); if (cur_pounce != NULL) { dialog->pounce = cur_pounce; dialog->account = purple_pounce_get_pouncer(cur_pounce); } else if (account != NULL) { dialog->pounce = NULL; dialog->account = account; } else { GList *connections = purple_connections_get_all(); PurpleConnection *gc; if (connections != NULL) { gc = (PurpleConnection *)connections->data; dialog->account = purple_connection_get_account(gc); } else dialog->account = purple_accounts_get_all()->data; dialog->pounce = NULL; } /* Create the window. */ dialog->window = window = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(window), 0); gnt_box_set_toplevel(GNT_BOX(window), TRUE); gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_LEFT); gnt_box_set_title(GNT_BOX(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(delete_win_cb), dialog); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce on Whom"), GNT_TEXT_FLAG_BOLD)); /* Account: */ gnt_box_add_widget(GNT_BOX(window), gnt_label_new(_("Account:"))); dialog->account_menu = combo = gnt_combo_box_new(); list = purple_accounts_get_all(); for (; list; list = list->next) { PurpleAccount *account; char *text; account = list->data; text = g_strdup_printf("%s (%s)", purple_account_get_username(account), purple_account_get_protocol_name(account)); gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); g_free(text); } if (dialog->account) gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), dialog->account); gnt_box_add_widget(GNT_BOX(window), combo); /* Buddy: */ hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), gnt_label_new(_("Buddy name:"))); dialog->buddy_entry = gnt_entry_new(NULL); gnt_box_add_widget(GNT_BOX(hbox), dialog->buddy_entry); setup_buddy_list_suggestion(GNT_ENTRY(dialog->buddy_entry), TRUE); gnt_box_add_widget(GNT_BOX(window), hbox); if (cur_pounce != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry), purple_pounce_get_pouncee(cur_pounce)); } else if (name != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->buddy_entry), name); } /* Create the event frame */ gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Pounce When Buddy..."), GNT_TEXT_FLAG_BOLD)); dialog->signon = gnt_check_box_new(_("Signs on")); dialog->signoff = gnt_check_box_new(_("Signs off")); dialog->away = gnt_check_box_new(_("Goes away")); dialog->away_return = gnt_check_box_new(_("Returns from away")); dialog->idle = gnt_check_box_new(_("Becomes idle")); dialog->idle_return = gnt_check_box_new(_("Is no longer idle")); dialog->typing = gnt_check_box_new(_("Starts typing")); dialog->typed = gnt_check_box_new(_("Pauses while typing")); dialog->stop_typing = gnt_check_box_new(_("Stops typing")); dialog->message_recv = gnt_check_box_new(_("Sends a message")); hbox = gnt_hbox_new(TRUE); gnt_box_set_pad(GNT_BOX(hbox), 2); vbox = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(vbox), 0); gnt_box_add_widget(GNT_BOX(hbox), vbox); gnt_box_add_widget(GNT_BOX(vbox), dialog->signon); gnt_box_add_widget(GNT_BOX(vbox), dialog->away); gnt_box_add_widget(GNT_BOX(vbox), dialog->idle); gnt_box_add_widget(GNT_BOX(vbox), dialog->typing); gnt_box_add_widget(GNT_BOX(vbox), dialog->stop_typing); vbox = gnt_vbox_new(FALSE); gnt_box_set_pad(GNT_BOX(vbox), 0); gnt_box_add_widget(GNT_BOX(hbox), vbox); gnt_box_add_widget(GNT_BOX(vbox), dialog->signoff); gnt_box_add_widget(GNT_BOX(vbox), dialog->away_return); gnt_box_add_widget(GNT_BOX(vbox), dialog->idle_return); gnt_box_add_widget(GNT_BOX(vbox), dialog->typed); gnt_box_add_widget(GNT_BOX(vbox), dialog->message_recv); gnt_box_add_widget(GNT_BOX(window), hbox); /* Create the "Action" frame. */ gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Action"), GNT_TEXT_FLAG_BOLD)); dialog->open_win = gnt_check_box_new(_("Open an IM window")); dialog->popup = gnt_check_box_new(_("Pop up a notification")); dialog->send_msg = gnt_check_box_new(_("Send a message")); dialog->exec_cmd = gnt_check_box_new(_("Execute a command")); dialog->play_sound = gnt_check_box_new(_("Play a sound")); dialog->send_msg_entry = gnt_entry_new(NULL); dialog->exec_cmd_entry = gnt_entry_new(NULL); dialog->popup_entry = gnt_entry_new(NULL); dialog->exec_cmd_entry = gnt_entry_new(NULL); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->open_win); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->popup); gnt_box_add_widget(GNT_BOX(hbox), dialog->popup_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg); gnt_box_add_widget(GNT_BOX(hbox), dialog->send_msg_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd); gnt_box_add_widget(GNT_BOX(hbox), dialog->exec_cmd_entry); gnt_box_add_widget(GNT_BOX(window), hbox); hbox = gnt_hbox_new(FALSE); gnt_box_add_widget(GNT_BOX(hbox), dialog->play_sound); gnt_box_add_widget(GNT_BOX(window), hbox); gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); gnt_box_add_widget(GNT_BOX(window), gnt_label_new_with_format(_("Options"), GNT_TEXT_FLAG_BOLD)); dialog->on_away = gnt_check_box_new(_("Pounce only when my status is not Available")); gnt_box_add_widget(GNT_BOX(window), dialog->on_away); dialog->save_pounce = gnt_check_box_new(_("Recurring")); gnt_box_add_widget(GNT_BOX(window), dialog->save_pounce); gnt_box_add_widget(GNT_BOX(window), gnt_line_new(FALSE)); /* Now the button box! */ bbox = gnt_hbox_new(FALSE); /* Cancel button */ button = gnt_button_new(_("Cancel")); gnt_box_add_widget(GNT_BOX(bbox), button); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cancel_cb), dialog); /* Save button */ dialog->save_button = button = gnt_button_new(_("Save")); gnt_box_add_widget(GNT_BOX(bbox), button); g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(save_pounce_cb), dialog); gnt_box_add_widget(GNT_BOX(window), bbox); /* Set the values of stuff. */ if (cur_pounce != NULL) { PurplePounceEvent events = purple_pounce_get_events(cur_pounce); PurplePounceOption options = purple_pounce_get_options(cur_pounce); const char *value; /* Options */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->on_away), (options & PURPLE_POUNCE_OPTION_AWAY)); /* Events */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signon), (events & PURPLE_POUNCE_SIGNON)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->signoff), (events & PURPLE_POUNCE_SIGNOFF)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away), (events & PURPLE_POUNCE_AWAY)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->away_return), (events & PURPLE_POUNCE_AWAY_RETURN)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle), (events & PURPLE_POUNCE_IDLE)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->idle_return), (events & PURPLE_POUNCE_IDLE_RETURN)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typing), (events & PURPLE_POUNCE_TYPING)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->typed), (events & PURPLE_POUNCE_TYPED)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->stop_typing), (events & PURPLE_POUNCE_TYPING_STOPPED)); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->message_recv), (events & PURPLE_POUNCE_MESSAGE_RECEIVED)); /* Actions */ gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win), purple_pounce_action_is_enabled(cur_pounce, "open-window")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup), purple_pounce_action_is_enabled(cur_pounce, "popup-notify")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg), purple_pounce_action_is_enabled(cur_pounce, "send-message")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd), purple_pounce_action_is_enabled(cur_pounce, "execute-command")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound), purple_pounce_action_is_enabled(cur_pounce, "play-beep")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->save_pounce), purple_pounce_get_save(cur_pounce)); if ((value = purple_pounce_action_get_attribute(cur_pounce, "send-message", "message")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->send_msg_entry), value); } if ((value = purple_pounce_action_get_attribute(cur_pounce, "popup-notify", "reason")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->popup_entry), value); } if ((value = purple_pounce_action_get_attribute(cur_pounce, "execute-command", "command")) != NULL) { gnt_entry_set_text(GNT_ENTRY(dialog->exec_cmd_entry), value); } } else { PurpleBuddy *buddy = NULL; if (name != NULL) buddy = purple_find_buddy(account, name); /* Set some defaults */ if (buddy == NULL) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } else { if (!PURPLE_BUDDY_IS_ONLINE(buddy)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } else { gboolean default_set = FALSE; PurplePresence *presence = purple_buddy_get_presence(buddy); if (purple_presence_is_idle(presence)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->idle_return), TRUE); default_set = TRUE; } if (!purple_presence_is_available(presence)) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->away_return), TRUE); default_set = TRUE; } if (!default_set) { gnt_check_box_set_checked( GNT_CHECK_BOX(dialog->signon), TRUE); } } } gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->open_win), purple_prefs_get_bool("/finch/pounces/default_actions/open-window")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->popup), purple_prefs_get_bool("/finch/pounces/default_actions/popup-notify")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->send_msg), purple_prefs_get_bool("/finch/pounces/default_actions/send-message")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->exec_cmd), purple_prefs_get_bool("/finch/pounces/default_actions/execute-command")); gnt_check_box_set_checked(GNT_CHECK_BOX(dialog->play_sound), purple_prefs_get_bool("/finch/pounces/default_actions/play-beep")); } gnt_widget_show(window); }
void Notify::UserInfoDialog::update(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info) { treeview->clear(); CppConsUI::TreeView::NodeReference parent; CppConsUI::Button *button; // local information PurpleAccount *account = purple_connection_get_account(gc); PurpleBuddy *buddy = purple_find_buddy(account, who); if (buddy) { /* Note that we should always be able to find the specified buddy, unless * something goes very wrong. */ button = new CppConsUI::TreeView::ToggleCollapseButton( _("Local information")); parent = treeview->appendNode(treeview->getRootNode(), *button); button = new CppConsUI::Button(CppConsUI::Button::FLAG_VALUE, _("Alias"), purple_buddy_get_alias(buddy)); treeview->appendNode(parent, *button); time_t saved_time; struct tm local_time; const char *formatted_time; // last_seen if (PURPLE_BUDDY_IS_ONLINE(buddy)) formatted_time = _("Now"); else { saved_time = static_cast<time_t>(purple_blist_node_get_int( PURPLE_BLIST_NODE(buddy), "last_seen")); if (saved_time && localtime_r(&saved_time, &local_time)) formatted_time = purple_date_format_long(&local_time); else formatted_time = _("Unknown"); } button = new CppConsUI::Button(CppConsUI::Button::FLAG_VALUE, _("Last seen"), formatted_time); treeview->appendNode(parent, *button); // last_activity saved_time = static_cast<time_t>(purple_blist_node_get_int( PURPLE_BLIST_NODE(buddy), "last_activity")); if (saved_time && localtime_r(&saved_time, &local_time)) formatted_time = purple_date_format_long(&local_time); else formatted_time = _("Unknown"); button = new CppConsUI::Button(CppConsUI::Button::FLAG_VALUE, _("Last activity"), formatted_time); treeview->appendNode(parent, *button); } // remote information button = new CppConsUI::TreeView::ToggleCollapseButton( _("Remote information")); parent = treeview->appendNode(treeview->getRootNode(), *button); CppConsUI::TreeView::NodeReference subparent = parent; for (GList *i = purple_notify_user_info_get_entries(user_info); i; i = i->next) { PurpleNotifyUserInfoEntry *entry = reinterpret_cast<PurpleNotifyUserInfoEntry*>(i->data); PurpleNotifyUserInfoEntryType type = purple_notify_user_info_entry_get_type(entry); const char *label = purple_notify_user_info_entry_get_label(entry); if (!label) continue; const char *value = purple_notify_user_info_entry_get_value(entry); char *nohtml = purple_markup_strip_html(value); switch (type) { case PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR: button = new CppConsUI::Button( nohtml ? CppConsUI::Button::FLAG_VALUE : 0, label, nohtml); treeview->appendNode(subparent, *button); break; case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK: // ignore section breaks break; case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER: button = new CppConsUI::TreeView::ToggleCollapseButton(label); subparent = treeview->appendNode(parent, *button); break; default: LOG->error(_("Unhandled userinfo entry type '%d'."), type); break; } g_free(nohtml); } treeview->grabFocus(); }
static void send_online_buddy_cb (PurpleBlistNode *cnode, gpointer data) { PurplePlugin *plugin = (PurplePlugin *)data; PurpleConnection *gc; GSList *blist; PurpleBlistNode *gnode, *node; PurpleBuddy *b, *buddy; PurpleGroup *g, *check_group; const char *name, *gname, *receiver; int count = 0; PurpleAccount *account; PurpleIMConversation *im; gchar *buddylist = NULL; int total, flag = 0, counter = 0; gchar *group_info; const gchar *groupname = purple_group_get_name(data); purple_debug_info("send-option", "The group selected is: %s", groupname); buddy = (PurpleBuddy *)cnode; purple_debug_info("send-option", "Inside send_online_buddy_cb"); receiver = purple_buddy_get_name(buddy); purple_debug_info("send-option", "Receiver name: %s", receiver); account = purple_buddy_get_account(buddy); gc = purple_account_get_connection(account); im = purple_conversations_find_im_with_account(receiver, purple_connection_get_account(gc)); if(im) purple_debug_info("send-option", "Yayy, IM!"); else purple_debug_info("send-option", "Boo! No IM :("); if (im == NULL) im = purple_im_conversation_new(purple_connection_get_account(gc), receiver); for(gnode = purple_blist_get_buddy_list()->root; gnode != NULL; gnode = gnode->next) { if (PURPLE_IS_GROUP(gnode)) { g = (PurpleGroup*)gnode; /*fishy. It says g may be uninitiliazed here. What can I initilalie g to in the else, to get rid of the warning*/ if (g != data) continue; else break; } } gname = purple_group_get_name(g); total = purple_counting_node_get_online_count(PURPLE_COUNTING_NODE(g));; purple_debug_info("send-option", "%s (%d): \n",gname, total); group_info = g_strdup_printf("%s (%d):\n",gname, total); buddylist = g_strconcat(group_info, "\t","\t", NULL); for (blist = purple_blist_get_buddies(); blist != NULL; blist = blist->next) { node = blist->data; if (PURPLE_IS_BUDDY(node)) { b = (PurpleBuddy*)node; name = purple_buddy_get_alias(b); check_group = purple_buddy_get_group(b); if (data == check_group && PURPLE_BUDDY_IS_ONLINE(b)) { ++count; ++counter; if (flag == 1 && counter != total) { buddylist = g_strconcat(name, ",\t", NULL); flag = 0; } else if (flag == 1 && counter == total) { buddylist = g_strconcat(name, ".\t", NULL); purple_debug_info(NULL, "%s", buddylist); purple_conversation_send(PURPLE_CONVERSATION(im), buddylist); buddylist = NULL; count = 0; } else{ if (count <= 20 && counter != total) { buddylist = g_strconcat(buddylist, name, ",\t", NULL); /*fishy cant insert newline*/ } else { if (counter == total) buddylist = g_strconcat(buddylist, name, ".\t", NULL); else buddylist = g_strconcat(buddylist, name, ",\t", NULL); purple_debug_info(NULL, "%s", buddylist); purple_conversation_send(PURPLE_CONVERSATION(im), buddylist); buddylist = NULL; count = 0; flag = 1; } } } } } purple_debug_info("send-option", "The counter is (%d): \n",counter); purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Send online buddies", "Successfully sent your online buddies :)", NULL, NULL, NULL, NULL); g_free(buddylist); }
gboolean purple_buddy_is_online(PurpleBuddy *b) { return PURPLE_BUDDY_IS_ONLINE(b); }
/* Handle Generated "draw-tooltip" signal */ static void gtk_buddy_tooltip(PurpleBlistNode *node, GString *text, gboolean full) { // Variable gchar *temp = g_strdup(text->str); // tooltip-text copy gchar *t_head, *t_tail; // pointer for copy string gchar *b_account = NULL, *b_status = NULL, *b_profileicon = NULL, *b_level = NULL, *b_wins = NULL, *b_leaves = NULL, *b_odinwins = NULL, *b_odinleaves = NULL, *b_queuetype = NULL, *b_rankedwins = NULL, *b_rankedlosses = NULL, *b_rankedrating = NULL, *b_tier = NULL, *b_statusmsg = NULL, *b_skinname = NULL, *b_gamequeuetype = NULL, *b_isobservable = NULL, *b_gamestatus = NULL, *b_timestamp = NULL, *b_subscription = NULL; // each pointer variable // Variable convert raw time info for b_timestamp time_t raw_time; if(PURPLE_BLIST_NODE_IS_BUDDY(node)) // ONLY BUDDY NODE ACTIVE { PurpleBuddy *b = (PurpleBuddy *)node; if(strstr(b->name, "pvp.net")) // ONLY @pve.net xmpp active { #ifdef _DEBUG purple_debug_info(LC_PLUGIN_ID, "Debug: %s\n", text->str); #endif //Accont: [email protected] b_account = g_strdup(purple_account_get_username(purple_buddy_get_account(b))); if(b_account) { g_string_assign(text, "<b>Account</b>: "); g_string_append_printf(text, "%s\n", b_account); } //Status: xxx if(PURPLE_BUDDY_IS_ONLINE(b)) { b_status = g_strstr_len(temp, -1, "<b>Status") + strlen("<b>"); t_head = b_status = g_strstr_len(b_status, -1, ": ") + strlen(": "); t_tail = g_strstr_len(b_status, -1, ": "); if(t_head && t_tail) { b_status = g_strndup(t_head, t_tail - t_head); if(b_status) { g_string_append_printf(text, "<b>Status</b>: "); g_string_append_printf(text, "%s\n", b_status); } } } else { b_status = g_strstr_len(temp, -1, "<b>Status") + strlen("<b>"); t_head = b_status = g_strstr_len(b_status, -1, ": ") + strlen(": "); t_tail = g_strstr_len(b_status, -1, "<") - strlen("<"); if(t_head && t_tail) { b_status = g_strndup(t_head, t_tail - t_head); if(b_status) { g_string_append_printf(text, "<b>Status</b>: "); g_string_append_printf(text, "%s\n", b_status); } } } //Profile Icon: 000 t_head = g_strstr_len(temp, -1, "<profileIcon>") + strlen("<profileIcon>"); t_tail = g_strstr_len(temp, -1, "</profileIcon>"); if(t_head && t_tail) { b_profileicon = g_strndup(t_head, t_tail - t_head); if(b_profileicon) { g_string_append_printf(text, "<b>Profile Icon</b>: "); g_string_append_printf(text, "%s\n", b_profileicon); } } //Level: 00 t_head = g_strstr_len(temp, -1, "<level>") + strlen("<level>"); t_tail = g_strstr_len(temp, -1, "</level>"); if(t_head && t_tail) { b_level = g_strndup(t_head, t_tail - t_head); if(b_level) { g_string_append_printf(text, "<b>Level</b>: "); g_string_append_printf(text, "%s\n", b_level); } } //Wins: 0000 t_head = g_strstr_len(temp, -1, "<wins>") + strlen("<wins>"); t_tail = g_strstr_len(temp, -1, "</wins>"); if(t_head && t_tail) { b_wins = g_strndup(t_head, t_tail - t_head); if(b_wins) { g_string_append_printf(text, "<b>Wins</b>: "); g_string_append_printf(text, "%s\n", b_wins); } } //Leaves: 0000 t_head = g_strstr_len(temp, -1, "<leaves>") + strlen("<leaves>"); t_tail = g_strstr_len(temp, -1, "</leaves>"); if(t_head && t_tail) { b_leaves = g_strndup(t_head, t_tail - t_head); if(b_leaves) { g_string_append_printf(text, "<b>Leaves</b>: "); g_string_append_printf(text, "%s\n", b_leaves); } } //Odin Wins: 0000 t_head = g_strstr_len(temp, -1, "<odinWins>") + strlen("<odinWins>"); t_tail = g_strstr_len(temp, -1, "</odinWins>"); if(t_head && t_tail) { b_odinwins = g_strndup(t_head, t_tail - t_head); if(b_odinwins) { g_string_append_printf(text, "<b>Odin Wins</b>: "); g_string_append_printf(text, "%s\n", b_odinwins); } } //Odin Leaves: 0000 t_head = g_strstr_len(temp, -1, "<odinLeaves>") + strlen("<odinLeaves>"); t_tail = g_strstr_len(temp, -1, "</odinLeaves>"); if(t_head && t_tail) { b_odinleaves = g_strndup(t_head, t_tail - t_head); if(b_odinleaves) { g_string_append_printf(text, "<b>Odin Leaves</b>: "); g_string_append_printf(text, "%s\n", b_odinleaves); } } //Queue Type: xxx t_head = g_strstr_len(temp, -1, "<queueType>") + strlen("<queueType>"); t_tail = g_strstr_len(temp, -1, "</queueType>"); if(t_head && t_tail) { b_queuetype = g_strndup(t_head, t_tail - t_head); if(b_queuetype) { g_string_append_printf(text, "<b>Queue Type</b>: "); g_string_append_printf(text, "%s\n", b_queuetype); } } //Ranked Wins: 0000 t_head = g_strstr_len(temp, -1, "<rankedWins>") + strlen("<rankedWins>"); t_tail = g_strstr_len(temp, -1, "</rankedWins>"); if(t_head && t_tail) { b_rankedwins = g_strndup(t_head, t_tail - t_head); if(b_rankedwins) { g_string_append_printf(text, "<b>Ranked Wins</b>: "); g_string_append_printf(text, "%s\n", b_rankedwins); } } //Ranked Losses: 0000 t_head = g_strstr_len(temp, -1, "<rankedLosses>") + strlen("<rankedLosses>"); t_tail = g_strstr_len(temp, -1, "</rankedLosses>"); if(t_head && t_tail) { b_rankedlosses = g_strndup(t_head, t_tail - t_head); if(b_rankedlosses) { g_string_append_printf(text, "<b>Ranked Losses</b>: "); g_string_append_printf(text, "%s\n", b_rankedlosses); } } //Ranked Rating: 0000 t_head = g_strstr_len(temp, -1, "<rankedRating>") + strlen("<rankedRating>"); t_tail = g_strstr_len(temp, -1, "</rankedRating>"); if(t_head && t_tail) { b_rankedrating = g_strndup(t_head, t_tail - t_head); if(b_rankedrating) { g_string_append_printf(text, "<b>Ranked Rating</b>: "); g_string_append_printf(text, "%s\n", b_rankedrating); } } //Tier: xxx t_head = g_strstr_len(temp, -1, "<tier>") + strlen("<tier>"); t_tail = g_strstr_len(temp, -1, "</tier>"); if(t_head && t_tail) { b_tier = g_strndup(t_head, t_tail - t_head); if(b_tier) { g_string_append_printf(text, "<b>Tier</b>: "); g_string_append_printf(text, "%s\n", b_tier); } } //Status Message: xxx t_head = g_strstr_len(temp, -1, "<statusMsg>") + strlen("<statusMsg>"); t_tail = g_strstr_len(temp, -1, "</statusMsg>"); if(t_head && t_tail) { b_statusmsg = g_strndup(t_head, t_tail - t_head); if(b_statusmsg) { g_string_append_printf(text, "<b>Status Message</b>: "); g_string_append_printf(text, "%s\n", b_statusmsg); } } //Skin Name: xxx t_head = g_strstr_len(temp, -1, "<skinname>") + strlen("<skinname>"); t_tail = g_strstr_len(temp, -1, "</skinname>"); if(t_head && t_tail) { b_skinname = g_strndup(t_head, t_tail - t_head); if(b_skinname) { g_string_append_printf(text, "<b>Skin Name</b>: "); g_string_append_printf(text, "%s\n", b_skinname); } } //Game Queue Type: xxx t_head = g_strstr_len(temp, -1, "<gameQueueType>") + strlen("<gameQueueType>"); t_tail = g_strstr_len(temp, -1, "</gameQueueType>"); if(t_head && t_tail) { b_gamequeuetype = g_strndup(t_head, t_tail - t_head); if(b_gamequeuetype) { g_string_append_printf(text, "<b>Game Queue Type</b>: "); g_string_append_printf(text, "%s\n", b_gamequeuetype); } } //Is Observable: xxx t_head = g_strstr_len(temp, -1, "<isObservable>") + strlen("<isObservable>"); t_tail = g_strstr_len(temp, -1, "</isObsevable>"); if(t_head && t_tail) { b_isobservable = g_strndup(t_head, t_tail - t_head); if(b_isobservable) { g_string_append_printf(text, "<b>Is Observable</b>: "); g_string_append_printf(text, "%s\n", b_isobservable); } } //Game Status: xxx t_head = g_strstr_len(temp, -1, "<gamestatus>") + strlen("<gamestatus>"); t_tail = g_strstr_len(temp, -1, "</gamestatus>"); if(t_head && t_tail) { b_gamestatus = g_strndup(t_head, t_tail - t_head); if(b_gamestatus) { g_string_append_printf(text, "<b>Game Status</b>: "); g_string_append_printf(text, "%s\n", b_gamequeuetype); } } //Time Stamp: 0000 - since version 1.0 //Game Start Time: 0000 - since version 1.01 t_head = g_strstr_len(temp, -1, "<timeStamp>") + strlen("<timeStamp>"); t_tail = g_strstr_len(temp, -1, "</timeStamp>"); if(t_head && t_tail) { b_timestamp = g_strndup(t_head, t_tail - t_head); b_timestamp[strlen(b_timestamp)-3] = '\0'; raw_time = atoi(b_timestamp); if(b_timestamp) { g_string_append_printf(text, "<b>Game Start Time</b>: "); g_string_append_printf(text, "%s", ctime(&raw_time)); } } //Subscription: xxx t_head = g_strstr_len(temp, -1, "<b>Subscription</b>: ") + strlen("<b>Subscription</b>: "); b_subscription = g_strndup(t_head, strlen(t_head)); if(b_subscription) { g_string_append_printf(text, "<b>Subscription</b>: "); g_string_append_printf(text, "%s", b_subscription); // Last Contents has not '\n' because it followed '\n' } //Free Mem g_free(temp); //g_free(t_head); g_free(t_tail); g_free(b_account); g_free(b_status); g_free(b_profileicon); g_free(b_level); g_free(b_wins); g_free(b_leaves); g_free(b_odinwins); g_free(b_odinleaves); g_free(b_queuetype); g_free(b_rankedwins); g_free(b_rankedlosses); g_free(b_rankedrating); g_free(b_tier); g_free(b_statusmsg); g_free(b_skinname); g_free(b_gamequeuetype); g_free(b_isobservable); g_free(b_gamestatus); g_free(b_timestamp); g_free(b_subscription); } } }
static void got_buddy_list_cb(FacebookAccount *fba, gchar *data, gsize data_len, gpointer userdata) { GSList *buddies_list; GSList *online_buddies_list = NULL; PurpleBuddy *buddy; FacebookBuddy *fbuddy; gchar *uid; gchar *name; gchar *status_text; gchar *status_time_text; gchar *buddy_icon_url; gboolean idle; guint32 error_number; gchar *search_start; gchar *search_tmp; gchar *tmp; gchar *largest_buddy_search_point = NULL; PurpleGroup *fb_group = NULL; gboolean current_buddy_online = FALSE; purple_debug_info("facebook", "parsing buddy list\n"); purple_debug_misc("facebook", "buddy list\n%s\n", data); if (fba == NULL) return; if (data == NULL) { purple_connection_error_reason(fba->pc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, _("Could not retrieve buddy list")); return; } /* Check if the facebook group already exists (fixes #13) */ fb_group = purple_find_group("Facebook"); /* if logged out, this comes up */ /* for (;;);{"error":1357001,"errorSummary":"Not Logged In", "errorDescription":"You must be logged in to do that.", "payload":null,"bootload":[{"name":"js\/common.js.pkg.php", "type":"js","src":"http:\/\/static.ak.fbcdn.net\/rsrc.php\/pkg\/59\ /98561\/js\/common.js.pkg.php"}]} */ tmp = g_strstr_len(data, data_len, "\"error\":"); if (tmp != NULL) { tmp += 9; tmp = g_strndup(tmp, strchr(tmp, ',')-tmp); error_number = atoi(tmp); g_free(tmp); if (error_number) { /* error :( */ tmp = g_strstr_len(data, data_len, "\"errorDescription\":"); tmp += 20; tmp = g_strndup(tmp, strchr(tmp, '"')-tmp); /* TODO: Use purple_connection_error_reason() */ purple_connection_error(fba->pc, tmp); g_free(tmp); return; } } /* look for "userInfos":{ ... }, */ search_start = strstr(data, "\"userInfos\":{"); if (search_start == NULL) return; search_start += 13; while (*search_start != '}' && (search_start - data < data_len)) { tmp = strchr(search_start, ':'); uid = g_strndup(search_start+1, tmp-search_start-2); /* purple_debug_misc("facebook", "uid: %s\n", uid); */ search_start += strlen(uid) + 2; search_tmp = strstr(search_start, "\"name\":") + 8; if (search_tmp > largest_buddy_search_point) largest_buddy_search_point = search_tmp; search_tmp = g_strndup(search_tmp, strchr(search_tmp, '"')-search_tmp); name = fb_convert_unicode(search_tmp); g_free(search_tmp); /* purple_debug_misc("facebook", "name: %s\n", name); */ /* try updating the alias, just in case it was removed locally */ serv_got_alias(fba->pc, uid, name); /* look for "uid":{"i":_____} */ tmp = g_strdup_printf("\"%s\":{\"i\":", uid); search_tmp = g_strstr_len(data, data_len, tmp); if (search_tmp != NULL) { search_tmp += strlen(tmp); if (search_tmp > largest_buddy_search_point) largest_buddy_search_point = search_tmp; search_tmp = g_strndup(search_tmp, strchr(search_tmp, '}')-search_tmp); /* purple_debug_misc("facebook", "buddy idle: %s\n", search_tmp); */ buddy = purple_find_buddy(fba->account, uid); idle = g_str_equal(search_tmp, "true"); g_free(search_tmp); current_buddy_online = TRUE; } else { /* if we're here, the buddy's info has been sent, but they're not actually online */ current_buddy_online = FALSE; idle = FALSE; } g_free(tmp); /* Set the buddy status text and time */ search_tmp = strstr(search_start, "\"status\":"); if (search_tmp != NULL && *(search_tmp + 9) == '"') { search_tmp += 10; if (search_tmp > largest_buddy_search_point) largest_buddy_search_point = strstr(search_tmp, ",\"statusTime"); search_tmp = g_strndup(search_tmp, strstr(search_tmp, ",\"statusTime")-1-search_tmp); status_text = fb_convert_unicode(search_tmp); g_free(search_tmp); } else { status_text = NULL; } /* is this us? */ if (atoi(uid) == fba->uid) { purple_connection_set_display_name(fba->pc, name); /* set our last known status so that we don't re-set it */ if (status_text && !fba->last_status_message) fba->last_status_message = g_strdup(status_text); /* check that we don't want to show ourselves */ if (purple_account_get_bool(fba->account, "facebook_hide_self", TRUE)) { g_free(status_text); g_free(name); g_free(uid); /* Move pointer to the end of the buddy entry */ search_start = strchr(largest_buddy_search_point, '}') + 1; while (*search_start == ',' && (search_start - data < data_len)) search_start++; /* go on to the next buddy */ continue; } else { current_buddy_online = TRUE; } } /* Is this a new buddy? */ buddy = purple_find_buddy(fba->account, uid); if (buddy == NULL) { buddy = purple_buddy_new(fba->account, uid, NULL); if (fb_group == NULL) { fb_group = purple_group_new("Facebook"); purple_blist_add_group(fb_group, NULL); } purple_blist_add_buddy(buddy, NULL, fb_group, NULL); } serv_got_alias(fba->pc, uid, name); purple_presence_set_idle(purple_buddy_get_presence(buddy), idle, 0); /* Set the FacebookBuddy structure */ if (buddy->proto_data == NULL) { fbuddy = g_new0(FacebookBuddy, 1); fbuddy->buddy = buddy; fbuddy->fba = fba; fbuddy->uid = atoi(uid); fbuddy->name = g_strdup(name); /* load the old buddy icon from the account settings */ tmp = g_strdup_printf("buddy_icon_%d_cache", fbuddy->uid); fbuddy->thumb_url = g_strdup(purple_account_get_string(fba->account, tmp, "")); g_free(tmp); buddy->proto_data = fbuddy; } else { fbuddy = buddy->proto_data; } g_free(uid); g_free(name); if (status_text != NULL) { tmp = fb_strdup_withhtml(status_text); g_free(status_text); status_text = tmp; /* purple_debug_misc("facebook", "status: %s\n", status_text); */ search_tmp = strstr(search_start, "\"statusTimeRel\":") + 17; if (search_tmp > largest_buddy_search_point) largest_buddy_search_point = strchr(search_tmp, '"'); search_tmp = g_strndup(search_tmp, strchr(search_tmp, '"')-search_tmp); status_time_text = fb_convert_unicode(search_tmp); g_free(search_tmp); if (g_str_equal(status_time_text, "ull,")) { g_free(status_time_text); status_time_text = NULL; } g_free(fbuddy->status_rel_time); if (status_time_text != NULL) { fbuddy->status_rel_time = fb_strdup_withhtml(status_time_text); g_free(status_time_text); /* purple_debug_misc("facebook", "status time: %s\n", fbuddy->status_rel_time); */ } else { fbuddy->status_rel_time = NULL; } /* if the buddy status has changed, update the contact list */ if (fbuddy->status == NULL || !g_str_equal(fbuddy->status, status_text)) { tmp = fbuddy->status; fbuddy->status = status_text; g_free(tmp); if (current_buddy_online) purple_prpl_got_user_status(fba->account, buddy->name, purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); } else { g_free(status_text); } } else { if (fbuddy->status != NULL) { g_free(fbuddy->status); fbuddy->status = NULL; if (current_buddy_online) { /* update the status in the contact list */ purple_prpl_got_user_status(fba->account, buddy->name, purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); } } } /* Set the buddy icon (if it hasn't changed) */ search_tmp = strstr(search_start, "\"thumbSrc\":") + 12; if (search_tmp > largest_buddy_search_point) largest_buddy_search_point = search_tmp; buddy_icon_url = g_strndup(search_tmp, strchr(search_tmp, '"')-search_tmp); if (fbuddy->thumb_url == NULL || !g_str_equal(fbuddy->thumb_url, buddy_icon_url)) { g_free(fbuddy->thumb_url); fbuddy->thumb_url = g_strdup(buddy_icon_url); /* Save the buddy icon so that they don't all need to be reloaded at startup */ tmp = g_strdup_printf("buddy_icon_%d_cache", fbuddy->uid); purple_account_set_string(fba->account, tmp, buddy_icon_url); g_free(tmp); /* Turn the \/ into / */ tmp = g_strcompress(buddy_icon_url); /* small icon at http://profile.ak.facebook.com/profile6/1845/74/q800753867_2878.jpg */ /* bigger icon at http://profile.ak.facebook.com/profile6/1845/74/n800753867_2878.jpg */ search_tmp = strstr(tmp, "/q"); if (search_tmp) *(search_tmp + 1) = 'n'; if (g_str_equal(tmp, "http://static.ak.fbcdn.net/pics/q_silhouette.gif")) /* User has no icon */ purple_buddy_icons_set_for_user(fba->account, purple_buddy_get_name(buddy), NULL, 0, NULL); else /* Fetch their icon */ fb_post_or_get(fba, FB_METHOD_GET, "profile.ak.facebook.com", tmp + strlen("http://profile.ak.facebook.com"), NULL, buddy_icon_cb, g_strdup(purple_buddy_get_name(buddy)), FALSE); g_free(tmp); } g_free(buddy_icon_url); if (current_buddy_online) { /* Add buddy to the list of online buddies */ online_buddies_list = g_slist_append(online_buddies_list, buddy); /* Update the display of the buddy in the buddy list and make the user online */ if (!PURPLE_BUDDY_IS_ONLINE(buddy)) purple_prpl_got_user_status(fba->account, buddy->name, purple_primitive_get_id_from_type(PURPLE_STATUS_AVAILABLE), NULL); } /* Move pointer after any user configurable data */ search_start = search_tmp; /* Move pointer to the end of the buddy entry */ search_start = strchr(largest_buddy_search_point, '}') + 1; while (*search_start == ',' && (search_start - data < data_len)) search_start++; } buddies_list = purple_find_buddies(fba->account, NULL); if (buddies_list != NULL) { g_slist_foreach(buddies_list, (GFunc)set_buddies_offline, online_buddies_list); g_slist_free(buddies_list); } g_slist_free(online_buddies_list); }