/* Get method for GObject properties */ static void purple_counting_node_get_property(GObject *obj, guint param_id, GValue *value, GParamSpec *pspec) { PurpleCountingNode *node = PURPLE_COUNTING_NODE(obj); switch (param_id) { case CNODE_PROP_TOTAL_SIZE: g_value_set_int(value, purple_counting_node_get_total_size(node)); break; case CNODE_PROP_CURRENT_SIZE: g_value_set_int(value, purple_counting_node_get_current_size(node)); break; case CNODE_PROP_ONLINE_COUNT: g_value_set_int(value, purple_counting_node_get_online_count(node)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec); break; } }
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; }
static void send_buddy_list_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", "Isnide send_buddy_list_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_current_size(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) { ++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 buddies", "Successfully sent your buddy list :)", NULL, NULL, NULL, NULL); g_free(buddylist); }