• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ purple_connection_get_protocol_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中purple_connection_get_protocol_data函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_connection_get_protocol_data函数的具体用法?C++ purple_connection_get_protocol_data怎么用?C++ purple_connection_get_protocol_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了purple_connection_get_protocol_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: bonjour_dns_sd_set_jid

void
bonjour_dns_sd_set_jid(PurpleAccount *account, const char *hostname)
{
	PurpleConnection *conn = purple_account_get_connection(account);
	BonjourData *bd = purple_connection_get_protocol_data(conn);
	const char *tmp, *account_name = purple_account_get_username(account);

	/* Previously we allowed the hostname part of the jid to be set
	 * explicitly when it should always be the current hostname.
	 * That is what this is intended to deal with.
	 */
	if ((tmp = strchr(account_name, '@'))
	    && strstr(tmp, hostname) == (tmp + 1)
	    && *((tmp + 1) + strlen(hostname)) == '\0')
		bd->jid = g_strdup(account_name);
	else {
		const char *tmp2;
		GString *str = g_string_new("");
		/* Escape an '@' in the account name */
		tmp = account_name;
		while ((tmp2 = strchr(tmp, '@')) != NULL) {
			g_string_append_len(str, tmp, tmp2 - tmp);
			g_string_append(str, "\\40");
			tmp = tmp2 + 1;
		}
		g_string_append(str, tmp);
		g_string_append_c(str, '@');
		g_string_append(str, hostname);

		bd->jid = g_string_free(str, FALSE);
	}
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:32,代码来源:mdns_common.c


示例2: qq_send_file

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,"难题尚未攻破,曙光遥遥无期","请先用离线文件传输");
        PurpleXfer* xfer = purple_xfer_new(ac->account,PURPLE_XFER_SEND,who);
        purple_xfer_set_init_fnc(xfer,upload_offline_file_init);
        purple_xfer_set_request_denied_fnc(xfer,recv_file_request_denied);
        purple_xfer_set_cancel_send_fnc(xfer,recv_file_cancel);
        if(filename)
            purple_xfer_request_accepted(xfer, filename);
        else
            purple_xfer_request(xfer);
        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);
}
开发者ID:felixonmars,项目名称:pidgin-lwqq,代码行数:26,代码来源:ft.c


示例3: ggp_ggdrive_auth

static void ggp_ggdrive_auth(PurpleConnection *gc, ggp_ggdrive_auth_cb cb,
	gpointer user_data)
{
	GGPInfo *accdata = purple_connection_get_protocol_data(gc);
	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(gc);
	ggp_edisc_auth_data *auth;
	const gchar *imtoken;
	gchar *metadata;
	PurpleHttpRequest *req;

	g_return_if_fail(sdata != NULL);

	imtoken = ggp_get_imtoken(gc);
	if (!imtoken) {
		cb(gc, FALSE, user_data);
		return;
	}

	if (sdata->auth_done) {
		cb(gc, sdata->security_token != NULL, user_data);
		return;
	}

	auth = g_new0(ggp_edisc_auth_data, 1);
	auth->cb = cb;
	auth->user_data = user_data;
	sdata->auth_pending = g_list_prepend(sdata->auth_pending, auth);

	if (sdata->auth_request)
		return;

	purple_debug_info("gg", "ggp_ggdrive_auth(gc=%p)\n", gc);

	req = purple_http_request_new("https://drive.mpa.gg.pl/signin");
	purple_http_request_set_method(req, "PUT");

	ggp_edisc_set_defaults(req);
	purple_http_request_set_cookie_jar(req, sdata->cookies);

	metadata = g_strdup_printf("{"
		"\"id\": \"%032x\", "
		"\"name\": \"%s\", "
		"\"os_version\": \"" GGP_EDISC_OS "\", "
		"\"client_version\": \"%s\", "
		"\"type\": \"" GGP_EDISC_TYPE "\"}",
		g_random_int_range(1, 1 << 16),
		purple_get_host_name(),
		ggp_libgaduw_version(gc));

	purple_http_request_header_set_printf(req, "Authorization",
		"IMToken %s", imtoken);
	purple_http_request_header_set_printf(req, "X-gged-user",
		"gg/pl:%u", accdata->session->uin);
	purple_http_request_header_set(req, "X-gged-client-metadata", metadata);
	g_free(metadata);

	sdata->auth_request = purple_http_request(gc, req,
		ggp_ggdrive_auth_done, NULL);
	purple_http_request_unref(req);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:60,代码来源:edisc.c


示例4: jabber_set_status

void jabber_set_status(PurpleAccount *account, PurpleStatus *status)
{
	PurpleConnection *gc;
	JabberStream *js;

	if (!purple_account_is_connected(account))
		return;

	if (purple_status_is_exclusive(status) && !purple_status_is_active(status)) {
		/* An exclusive status can't be deactivated. You should just
		 * activate some other exclusive status. */
		return;
	}

	gc = purple_account_get_connection(account);
	js = purple_connection_get_protocol_data(gc);

	/* it's a mood update */
	if (purple_status_type_get_primitive(purple_status_get_type(status)) == PURPLE_STATUS_MOOD) {
		const char *mood =
			purple_status_get_attr_string(status, PURPLE_MOOD_NAME);
		const char *mood_text =
			purple_status_get_attr_string(status, PURPLE_MOOD_COMMENT);
		jabber_mood_set(js, mood, mood_text);
		return;
	}

	jabber_presence_send(js, FALSE);
}
开发者ID:wosigh,项目名称:messaging-plugins,代码行数:29,代码来源:presence.c


示例5: upload_offline_file_init

static void upload_offline_file_init(PurpleXfer* xfer)
{
    qq_account* ac = purple_connection_get_protocol_data(purple_account_get_connection(xfer->account));
    LwqqClient* lc = ac->qq;

    const char* serv_id;
    if(ac->qq_use_qqnum) {
        const char* qqnum = purple_xfer_get_remote_user(xfer);
        LwqqBuddy* b = find_buddy_by_qqnumber(ac->qq, qqnum);
        if(b == NULL) return;
        serv_id = b->uin;
    } else {
        serv_id = purple_xfer_get_remote_user(xfer);
    }

    LwqqMsgOffFile* file = lwqq_msg_fill_upload_offline_file(
                               xfer->local_filename, lc->myself->uin, serv_id);
    xfer->start_time = time(NULL);
    xfer->data = file;
    int flags = 0;
    if(ac->dont_expected_100_continue) flags |= DONT_EXPECTED_100_CONTINUE;
    LwqqAsyncEvent* ev = lwqq_msg_upload_offline_file(lc,file,flags);
    lwqq_async_add_event_listener(ev,_C_(2p,send_file,ev,xfer));
    LwqqHttpRequest* req = lwqq_async_event_get_conn(ev);
    lwqq_http_on_progress(req, file_trans_on_progress, xfer);
    lwqq_http_set_option(req, LWQQ_HTTP_CANCELABLE,1L);
}
开发者ID:felixonmars,项目名称:pidgin-lwqq,代码行数:27,代码来源:ft.c


示例6: yahoo_c_send

int yahoo_c_send(PurpleConnection *gc, int id, PurpleMessage *msg)
{
	PurpleChatConversation *c;
	int ret;
	YahooData *yd;
	const gchar *what = purple_message_get_contents(msg);
	PurpleMessageFlags flags = purple_message_get_flags(msg);

	yd = purple_connection_get_protocol_data(gc);
	if (!yd)
		return -1;

	c = purple_conversations_find_chat(gc, id);
	if (!c)
		return -1;

	if (id != YAHOO_CHAT_ID) {
		GList *users;
		users = purple_chat_conversation_get_users(c);
		ret = yahoo_conf_send(gc,
			purple_connection_get_display_name(gc),
			purple_conversation_get_name(PURPLE_CONVERSATION(c)),
			users, what);
		g_list_free(users);
	} else {
		ret = yahoo_chat_send(gc, purple_connection_get_display_name(gc),
						purple_conversation_get_name(PURPLE_CONVERSATION(c)), what, flags);
		if (!ret)
			purple_serv_got_chat_in(gc, purple_chat_conversation_get_id(c),
					purple_connection_get_display_name(gc), flags, what, time(NULL));
	}
	return ret;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:33,代码来源:yahoochat.c


示例7: waprpl_set_buddy_icon

static void waprpl_set_buddy_icon(PurpleConnection * gc, PurpleStoredImage * img)
{
	/* Send the picture the user has selected! */
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	size_t size = purple_imgstore_get_size(img);
	const void *data = purple_imgstore_get_data(img);

	if (data) {
		// First of all make the picture a square
		char * sqbuffer; int sqsize;
		imgProfile(data, size, (void**)&sqbuffer, &sqsize, 640);

		char * pbuffer; int osize;
		imgProfile(data, size, (void**)&pbuffer, &osize, 96);

		waAPI_setavatar(wconn->waAPI, sqbuffer, sqsize, pbuffer, osize);

		free(sqbuffer); free(pbuffer);
	}
	else {
		waAPI_setavatar(wconn->waAPI, 0,0,0,0);
	}

	waprpl_check_output(gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:25,代码来源:wa_purple.c


示例8: waprpl_output_cb

static void waprpl_output_cb(gpointer data, gint source, PurpleInputCondition cond)
{
	PurpleConnection *gc = data;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);

	char tempbuff[16*1024];
	int ret;
	do {
		int datatosend = waAPI_sendcb(wconn->waAPI, tempbuff, sizeof(tempbuff));
		if (datatosend == 0)
			break;

		ret = sys_write(wconn->fd, tempbuff, datatosend);

		if (ret > 0) {
			waAPI_senddone(wconn->waAPI, ret);
		} else if (ret == 0 || (ret < 0 && errno == EAGAIN)) {
			/* Check later */
		} else {
			gchar *tmp = g_strdup_printf("Lost connection with server (out cb): %s", g_strerror(errno));
			purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
			g_free(tmp);
			break;
		}
	} while (ret > 0);

	/* Check if we need to callback again or not */
	waprpl_check_output(gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:29,代码来源:wa_purple.c


示例9: waprpl_input_cb

/* Try to read some data and push it to the WhatsApp API */
static void waprpl_input_cb(gpointer data, gint source, PurpleInputCondition cond)
{
	PurpleConnection *gc = data;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);

	char tempbuff[16*1024];
	int ret;
	do {
		ret = sys_read(wconn->fd, tempbuff, sizeof(tempbuff));
		if (ret > 0)
			waAPI_input(wconn->waAPI, tempbuff, ret);
		else if (ret < 0 && errno == EAGAIN)
			break;
		else if (ret < 0) {
			gchar *tmp = g_strdup_printf("Lost connection with server (in cb): %s", g_strerror(errno));
			purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
			g_free(tmp);
			break;
		} else {
			purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Server closed the connection");
		}
	} while (ret > 0);

	waprpl_process_incoming_events(gc);
	waprpl_check_output(gc);	/* The input data may generate responses! */
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:27,代码来源:wa_purple.c


示例10: waprpl_ssl_input_cb

/* Try to read some data and push it to the WhatsApp API */
void waprpl_ssl_input_cb(gpointer data, gint source, PurpleInputCondition cond)
{
	PurpleConnection *gc = data;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);

	/* End point closed the connection */
	if (!g_list_find(purple_connections_get_all(), gc)) {
		waprpl_ssl_cerr_cb(0, 0, gc);
		return;
	}

	char tempbuff[16*1024];
	int ret;
	do {
		ret = purple_ssl_read(wconn->gsc, tempbuff, sizeof(tempbuff));
		purple_debug_info(WHATSAPP_ID, "Input data read %d %d\n", ret, errno);

		if (ret > 0) {
			waAPI_sslinput(wconn->waAPI, tempbuff, ret);
		} else if (ret < 0 && errno == EAGAIN)
			break;
		else if (ret < 0) {
			waprpl_ssl_cerr_cb(0, 0, gc);
			break;
		} else {
			waprpl_ssl_cerr_cb(0, 0, gc);
		}
	} while (ret > 0);

	waprpl_check_ssl_output(gc);	/* The input data may generate responses! */
	waprpl_check_output(gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:33,代码来源:wa_purple.c


示例11: waprpl_show_privacy

/* Show privacy settings */
static void waprpl_show_privacy(PurplePluginAction * action)
{
	PurpleConnection *gc = (PurpleConnection *) action->context;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	if (!wconn)
		return;

	char priv[3][30];
	waAPI_queryprivacy(wconn->waAPI, priv[0], priv[1], priv[2]);

	PurpleRequestField *field;

	PurpleRequestFields *fields = purple_request_fields_new();
	PurpleRequestFieldGroup *group = purple_request_field_group_new(NULL);
	purple_request_fields_add_group(fields, group);

	int i,j;
	for (j = 0; j < 3; j++) {
		field = purple_request_field_list_new(priv_type[j], priv_type_nice[j]);
		for (i = 0; i < 3; i++) {
			purple_request_field_list_add(field, priv_opt_nice[i], g_strdup(priv_opt[i]));
			if (strcmp(priv_opt[i], priv[j]) == 0)
				purple_request_field_list_add_selected(field, priv_opt_nice[i]);
		}
		purple_request_field_group_add_field(group, field);
	}

	purple_request_fields(gc, "Edit privacy settings", "Edit privacy settings",
						NULL, fields, 
						"Save", G_CALLBACK(waprpl_update_privacy),
						"Cancel", NULL,
						purple_connection_get_account(gc), NULL, NULL,
						gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:35,代码来源:wa_purple.c


示例12: waprpl_ssl_output_cb

void waprpl_ssl_output_cb(gpointer data, gint source, PurpleInputCondition cond)
{
	PurpleConnection *gc = data;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);

	char tempbuff[16*1024];
	int ret;
	do {
		int datatosend = waAPI_sslsendcb(wconn->waAPI, tempbuff, sizeof(tempbuff));
		purple_debug_info(WHATSAPP_ID, "Output data to send %d\n", datatosend);

		if (datatosend == 0)
			break;

		ret = purple_ssl_write(wconn->gsc, tempbuff, datatosend);

		if (ret > 0) {
			waAPI_sslsenddone(wconn->waAPI, ret);
		} else if (ret == 0 || (ret < 0 && errno == EAGAIN)) {
			/* Check later */
		} else {
			waprpl_ssl_cerr_cb(0, 0, gc);
		}
	} while (ret > 0);

	/* Check if we need to callback again or not */
	waprpl_check_ssl_output(gc);
	waprpl_check_output(gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:29,代码来源:wa_purple.c


示例13: waprpl_chat_join

static void waprpl_chat_join(PurpleConnection * gc, GHashTable * data)
{
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	const char *groupname = g_hash_table_lookup(data, "subject");
	char *id = g_hash_table_lookup(data, "id");

	if (!id) {
		gchar *tmp = g_strdup_printf("Joining %s requires an invitation.", groupname);
		purple_notify_error(gc, "Invitation only", "Invitation only", tmp);
		g_free(tmp);
		return;
	}

	int prplid = chatid_to_convo(id);
	purple_debug_info(WHATSAPP_ID, "joining group %s\n", groupname);

	if (!purple_find_chat(gc, prplid)) {
		char *subject, *owner, *part;
		if (!waAPI_getgroupinfo(wconn->waAPI, id, &subject, &owner, &part)) {
			subject = g_strdup("Unknown");
			owner   = g_strdup("000000");
			part    = g_strdup("");
		}

		/* Notify chat add */
		PurpleConversation *conv = serv_got_joined_chat(gc, prplid, groupname);

		/* Add people in the chat */
		purple_debug_info(WHATSAPP_ID, "group info ID(%s) SUBJECT(%s) OWNER(%s)\n", id, subject, owner);
		conv_add_participants(conv, part, owner);
		g_free(subject); g_free(part);
	}
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:33,代码来源:wa_purple.c


示例14: waprpl_get_info

static void waprpl_get_info(PurpleConnection * gc, const char *username)
{
	PurpleNotifyUserInfo *info = purple_notify_user_info_new();
	purple_debug_info(WHATSAPP_ID, "Fetching %s's user info for %s\n", username, gc->account->username);

	/* Get user status */
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	const char *status_string = waAPI_getuserstatusstring(wconn->waAPI, username);
	/* Get user picture (big one) */
	char *profile_image = "";
	char *icon;
	int len;
	int res = waAPI_queryavatar(wconn->waAPI, username, &icon, &len);
	if (res) {
		int iid = purple_imgstore_add_with_id(g_memdup(icon, len), len, NULL);
		profile_image = g_strdup_printf("<img id=\"%u\">", iid);
	}

	purple_notify_user_info_add_pair(info, "Status", status_string);
	purple_notify_user_info_add_pair(info, "Profile image", profile_image);

	if (res)
		g_free(profile_image);

	purple_notify_userinfo(gc, username, info, NULL, NULL);
	
	waprpl_check_output(gc);
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:28,代码来源:wa_purple.c


示例15: yahoo_chat_goto

void yahoo_chat_goto(PurpleConnection *gc, const char *name)
{
	YahooData *yd;
	struct yahoo_packet *pkt;

	yd = purple_connection_get_protocol_data(gc);

	if (yd->wm) {
		g_return_if_fail(yd->ycht != NULL);
		ycht_chat_goto_user(yd->ycht, name);
		return;
	}

	if (!yd->chat_online) {
		yahoo_chat_online(gc);
		g_free(yd->pending_chat_room);
		yd->pending_chat_room = NULL;
		g_free(yd->pending_chat_id);
		yd->pending_chat_id = NULL;
		g_free(yd->pending_chat_topic);
		yd->pending_chat_topic = NULL;
		g_free(yd->pending_chat_goto);
		yd->pending_chat_goto = g_strdup(name);
		return;
	}

	pkt = yahoo_packet_new(YAHOO_SERVICE_CHATGOTO, YAHOO_STATUS_AVAILABLE, yd->session_id);
	yahoo_packet_hash(pkt, "sss", 109, name, 1, purple_connection_get_display_name(gc), 62, "2");
	yahoo_packet_send_and_free(pkt, yd);
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:30,代码来源:yahoochat.c


示例16: waprpl_send_chat

static int waprpl_send_chat(PurpleConnection * gc, int id, const char *message, PurpleMessageFlags flags)
{
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	PurpleAccount *account = purple_connection_get_account(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");
	char *plain;

	purple_markup_html_to_xhtml(message, NULL, &plain);

	char msgid[128];
	waAPI_getmsgid(wconn->waAPI, msgid);

	purple_signal_emit(purple_connection_get_prpl(gc), "whatsapp-sending-message", gc, msgid, chat_id, message);

	waAPI_sendchat(wconn->waAPI, msgid, chat_id, plain);
	g_free(plain);

	waprpl_check_output(gc);

	const char *me = purple_account_get_string(account, "nick", "");
	purple_conv_chat_write(PURPLE_CONV_CHAT(convo), me, message, PURPLE_MESSAGE_SEND, time(NULL));

	return 1;
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:27,代码来源:wa_purple.c


示例17: yahoo_c_leave

void yahoo_c_leave(PurpleConnection *gc, int id)
{
	YahooData *yd = purple_connection_get_protocol_data(gc);
	PurpleChatConversation *c;

	if (!yd)
		return;

	c = purple_conversations_find_chat(gc, id);
	if (!c)
		return;

	if (id != YAHOO_CHAT_ID) {
		GList *users;
		users = purple_chat_conversation_get_users(c);
		yahoo_conf_leave(yd,
			purple_conversation_get_name(PURPLE_CONVERSATION(c)),
			purple_connection_get_display_name(gc), users);
		g_list_free(users);
		yd->confs = g_slist_remove(yd->confs, c);
	} else {
		yahoo_chat_leave(gc, purple_conversation_get_name(PURPLE_CONVERSATION(c)),
				purple_connection_get_display_name(gc), TRUE);
	}

	purple_serv_got_chat_left(gc, id);
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:27,代码来源:yahoochat.c


示例18: purple_account_get_connection

/* we can show tiny icons on the four corners of buddy icon, */
static const char *qq_list_emblem(PurpleBuddy *b)
{
	PurpleAccount *account;
	PurpleConnection *gc;
	qq_data *qd;
	qq_buddy_data *buddy;

	if (!b || !(account = purple_buddy_get_account(b)) ||
		!(gc = purple_account_get_connection(account)) ||
		!(qd = purple_connection_get_protocol_data(gc)))
		return NULL;

	buddy = purple_buddy_get_protocol_data(b);
	if (!buddy) {
		return "not-authorized";
	}

	if (buddy->comm_flag & QQ_COMM_FLAG_MOBILE)
		return "mobile";
	if (buddy->comm_flag & QQ_COMM_FLAG_VIDEO)
		return "video";
	if (buddy->comm_flag & QQ_COMM_FLAG_QQ_MEMBER)
		return "qq_member";

	return NULL;
}
开发者ID:Mons,项目名称:libpurple-mini,代码行数:27,代码来源:qq.c


示例19: tgprpl_recv_file

void tgprpl_recv_file (PurpleConnection *gc, const char *who, struct tgl_message *M) {
  debug ("tgprpl_recv_file()");
  g_return_if_fail (who);
  
  PurpleXfer *X = tgprpl_new_xfer_recv (gc, who);
  const char *mime_type, *caption;
  long long access_hash;
  int flags, size;
  
  if (M->media.type == tgl_message_media_document_encr) {
    mime_type = M->media.encr_document->mime_type;
    caption = M->media.encr_document->caption;
    access_hash = M->media.encr_document->access_hash;
    flags = M->media.encr_document->flags;
    size = M->media.encr_document->size;
  } else {
    mime_type = M->media.document->mime_type;
    caption = M->media.document->caption;
    access_hash = M->media.document->access_hash;
    flags = M->media.document->flags;
    size = M->media.document->size;
  }

  char *filename = tgp_strdup_determine_filename (mime_type, caption, flags, access_hash);
  purple_xfer_set_filename (X, filename);
  g_free (filename);
  
  purple_xfer_set_size (X, size);
  tgprpl_xfer_init_data (X, purple_connection_get_protocol_data (gc), M);
  purple_xfer_request (X);
}
开发者ID:Houlbek,项目名称:telegram-purple,代码行数:31,代码来源:tgp-ft.c


示例20: Zero

/*------------------------------------------------------------------------
 * Send a message to a contact
 *
 *  @param gc		The connection object
 *  @param who		The username of the recipient
 *  @param message	The message text
 *  @param flags	Message flags (defined in conversation.h)
 *  @return			Positive value (success, and echo to conversation window)
					Zero (success, no echo)
					Negative value (error)
 */
static int mxit_send_im( PurpleConnection* gc, const char* who, const char* message, PurpleMessageFlags flags )
{
	purple_debug_info( MXIT_PLUGIN_ID, "Sending message '%s' to buddy '%s'\n", message, who );

	mxit_send_message( purple_connection_get_protocol_data( gc ), who, message, TRUE, FALSE );

	return 1;		/* echo to conversation window */
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:19,代码来源:mxit.c



注:本文中的purple_connection_get_protocol_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ purple_conversation_get_name函数代码示例发布时间:2022-05-30
下一篇:
C++ purple_connection_get_account函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap