static void waprpl_chat_invite(PurpleConnection *gc, int id, const char *message, const char *name) { whatsapp_connection * wconn = purple_connection_get_protocol_data(gc); PurpleAccount *account = purple_connection_get_account(gc); PurpleConversation *convo = purple_find_chat(gc, id); PurpleBlistNode* node = purple_blist_get_root(); GHashTable* hasht = NULL; while (node != 0) { if (PURPLE_BLIST_NODE_IS_CHAT(node)) { PurpleChat * ch = PURPLE_CHAT(node); if (purple_chat_get_account(ch) == account) { hasht = purple_chat_get_components(ch); if (chatid_to_convo(g_hash_table_lookup(hasht, "id")) == id) { break; } } } node = purple_blist_node_next(node,FALSE); } char * chat_id = g_hash_table_lookup(hasht, "id"); if (strstr(name,"@s.whatsapp.net") == 0) name = g_strdup_printf("*****@*****.**",name); waAPI_manageparticipant(wconn->waAPI, chat_id, name, "add"); purple_conv_chat_add_user (purple_conversation_get_chat_data(convo), name, "", PURPLE_CBFLAGS_NONE, FALSE); waprpl_check_output(gc); return 1; }
static void waprpl_chat_invite(PurpleConnection * gc, int id, const char *message, const char *name) { whatsapp_connection *wconn = purple_connection_get_protocol_data(gc); PurpleConversation *convo = purple_find_chat(gc, id); PurpleChat *ch = blist_find_chat_by_convo(gc, id); GHashTable *hasht = purple_chat_get_components(ch); char *chat_id = g_hash_table_lookup(hasht, "id"); if (strstr(name, "@s.whatsapp.net") == 0) name = g_strdup_printf("*****@*****.**", name); waAPI_manageparticipant(wconn->waAPI, chat_id, name, "add"); purple_conv_chat_add_user(purple_conversation_get_chat_data(convo), name, "", PURPLE_CBFLAGS_NONE, FALSE); waprpl_check_output(gc); }