Пример #1
0
void showMsg(const char* content,const char* title,wichatDialogType mode)
{
    char* _title = NULL;
    if (title)
        _title=(char*)title;
    else
    {
        _title=malloc(sizeof(char) * 16);
        strcpy(_title,"WiChat ");
        switch(mode)
        {
            case wichat_dialog_error:
                strcat(_title,"error");break;
            case wichat_dialog_warning:
                strcat(_title,"warning");break;
            case wichat_dialog_info:
                strcat(_title,"notice");
        }
    }
    switch(mode)
    {
        case wichat_dialog_info:
            purple_notify_info(this_plugin,_title,content,NULL); break;
        case wichat_dialog_warning:
            purple_notify_warning(this_plugin,_title,content,NULL); break;
        case wichat_dialog_error:
            purple_notify_error(this_plugin,_title,content,NULL);
    }
    if (title != _title && _title) free(_title);
}
Пример #2
0
/* send packet to join a group without auth */
void qq_request_room_join(PurpleConnection *gc, qq_room_data *rmd)
{
	g_return_if_fail(rmd != NULL);

	if (rmd->my_role == QQ_ROOM_ROLE_NO) {
		rmd->my_role = QQ_ROOM_ROLE_REQUESTING;
	}

	switch (rmd->auth_type) {
	case QQ_ROOM_AUTH_TYPE_NO_AUTH:
	case QQ_ROOM_AUTH_TYPE_NEED_AUTH:
		break;
	case QQ_ROOM_AUTH_TYPE_NO_ADD:
		if (rmd->my_role == QQ_ROOM_ROLE_NO
				&& rmd->my_role == QQ_ROOM_ROLE_REQUESTING) {
			purple_notify_warning(gc, NULL, _("The Qun does not allow others to join"), NULL);
			return;
		}
		break;
	default:
		purple_debug_error("QQ", "Unknown room auth type: %d\n", rmd->auth_type);
		break;
	}

	qq_send_room_cmd_only(gc, QQ_ROOM_CMD_JOIN, rmd->id);
}
Пример #3
0
static void no_upnp()
{
	char msg[100];
	snprintf(msg,100,"You must manually open the port %d on the router, if any",atoi(purple_value_get_string(port)));
	purple_notify_warning(the_plugin,"No upnp available","Port mapping",msg);
	const char* ip=purple_network_get_my_ip(-1);
	purple_debug_misc(PLUGIN_ID,"purple_network_get_my_ip(-1)=\"%s\"\n",ip);
	purple_value_set_string(server_ip,ip);
	start_direct_connection();
}
Пример #4
0
static void
history_prefs_check(PurplePlugin *plugin)
{
	if (!purple_prefs_get_bool("/purple/logging/log_ims") &&
	    !purple_prefs_get_bool("/purple/logging/log_chats"))
	{
		purple_notify_warning(plugin, NULL, _("History Plugin Requires Logging"),
							_("Logging can be enabled from Tools -> Preferences -> Logging.\n\n"
							  "Enabling logs for instant messages and/or chats will activate "
							  "history for the same conversation type(s)."), NULL);
	}
}
Пример #5
0
void PurpleLine::join_chat(GHashTable *components) {
    char *id_ptr = (char *)g_hash_table_lookup(components, "id");
    if (!id_ptr) {
        purple_debug_warning("line", "Tried to join a chat with no id.\n");
        return;
    }

    std::string id(id_ptr);

    ChatType type = get_chat_type((char *)g_hash_table_lookup(components, "type"));

    if (type == ChatType::ANY) {
        purple_debug_warning("line", "Tried to join a chat with weird type.\n");
        return;
    }

    if (type == ChatType::GROUP_INVITE) {
        c_out->send_acceptGroupInvitation(0, id);
        c_out->send([this, id]{
            try {
                c_out->recv_acceptGroupInvitation();
            } catch (line::TalkException &err) {
                purple_notify_warning(
                    (void *)conn,
                    "Failed to join LINE group",
                    "Your invitation was probably cancelled.",
                    err.reason.c_str());
                return;
            }

            c_out->send_getGroup(id);
            c_out->send([this]{
                line::Group group;
                c_out->recv_getGroup(group);

                if (!group.__isset.id) {
                    purple_debug_warning("line", "Couldn't get group: %s\n", group.id.c_str());
                    return;
                }

                join_chat_success(ChatType::GROUP, group.id);
            });
        });

        return;
    }

    join_chat_success(type, id);
}
Пример #6
0
void qq_send_file(PurpleConnection* gc,const char* who,const char* filename)
{
    qq_account* ac = purple_connection_get_protocol_data(gc);
    if(!ac->debug_file_send){
        purple_notify_warning(gc,NULL,"难题尚未攻破,曙光遥遥无期","请先用离线文件传输");
        return;
    }
    PurpleAccount* account = ac->account;
    PurpleXfer* xfer = purple_xfer_new(account,PURPLE_XFER_SEND,who);
    purple_xfer_set_init_fnc(xfer,upload_file_init);
    //purple_xfer_set_init_fnc(xfer,upload_offline_file_init);
    //purple_xfer_set_request_denied_fnc(xfer,file_trans_request_denied);
    //purple_xfer_set_cancel_send_fnc(xfer,file_trans_cancel);
    void** data = s_malloc(sizeof(void*)*3);
    data[0] = ac;
    xfer->data = data;
    purple_xfer_request(xfer);
}
Пример #7
0
void hon_parse_global_notification(PurpleConnection *gc,gchar* buffer){
    gchar* username = read_string(buffer);
    purple_notify_warning(NULL,username,buffer,NULL);
}
Пример #8
0
void
skypeweb_search_users_text_cb(SkypeWebAccount *sa, JsonNode *node, gpointer user_data)
{
	JsonArray *resultsarray = NULL;
	gint index, length;
	GString *userids;
	gchar *search_term = user_data;

	PurpleNotifySearchResults *results;
	PurpleNotifySearchColumn *column;
	
	resultsarray = json_node_get_array(node);
	length = json_array_get_length(resultsarray);
	
	if (length == 0)
	{
		gchar *primary_text = g_strdup_printf("Your search for the user \"%s\" returned no results", search_term);
		purple_notify_warning(sa->pc, "No users found", primary_text, "");
		g_free(primary_text);
		g_free(search_term);
		return;
	}
	
	userids = g_string_new("");
	
	resultsarray = json_node_get_array(node);
	for(index = 0; index < length; index++)
	{
		JsonObject *result = json_array_get_object_element(resultsarray, index);
		g_string_append_printf(userids, "%s,", json_object_get_string_member(result, "skypewebid"));
	}

	
	results = purple_notify_searchresults_new();
	if (results == NULL)
	{
		g_free(search_term);
		return;
	}
		
	/* columns: Friend ID, Name, Network */
	column = purple_notify_searchresults_column_new(_("Skype Name"));
	purple_notify_searchresults_column_add(results, column);
	column = purple_notify_searchresults_column_new(_("Display Name"));
	purple_notify_searchresults_column_add(results, column);
	column = purple_notify_searchresults_column_new(_("City"));
	purple_notify_searchresults_column_add(results, column);
	column = purple_notify_searchresults_column_new(_("Country"));
	purple_notify_searchresults_column_add(results, column);
	
	purple_notify_searchresults_button_add(results,
			PURPLE_NOTIFY_BUTTON_ADD,
			skypeweb_search_results_add_buddy);
	
	for(index = 0; index < length; index++)
	{
		JsonObject *contact = json_array_get_object_element(resultsarray, index);
		JsonObject *contactcards = json_object_get_object_member(contact, "ContactCards");
		JsonObject *skypecontact = json_object_get_object_member(contactcards, "Skype");
		JsonObject *currentlocation = json_object_get_object_member(contactcards, "CurrentLocation");
		
		/* the row in the search results table */
		/* prepend to it backwards then reverse to speed up adds */
		GList *row = NULL;
		
		row = g_list_prepend(row, g_strdup(json_object_get_string_member(skypecontact, "SkypeName")));
		row = g_list_prepend(row, g_strdup(json_object_get_string_member(skypecontact, "DisplayName")));
		row = g_list_prepend(row, g_strdup(json_object_get_string_member(currentlocation, "City")));
		row = g_list_prepend(row, g_strdup(json_object_get_string_member(currentlocation, "Country")));
		
		row = g_list_reverse(row);
		
		purple_notify_searchresults_row_add(results, row);
	}
	
	purple_notify_searchresults(sa->pc, NULL, search_term, NULL,
			results, NULL, NULL);
}
static void
notify_warn_cb(PurplePluginAction *action)
{
    purple_notify_warning(question_and_answer_plugin, "Test Notification", "Test Notification",
        "This is a test warning notification");
}