您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ userfunc函数代码示例

51自学网 2021-06-03 09:23:12
  C++
这篇教程C++ userfunc函数代码示例写得很实用,希望能帮到您。

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

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

示例1: SDL_RunThread

void SDL_RunThread(void *data){	thread_args *args;	int (*userfunc)(void *);	void *userdata;	int *statusloc;	/* Perform any system-dependent setup	   - this function cannot fail, and cannot use SDL_SetError()	 */	SDL_SYS_SetupThread();	/* Get the thread id */	args = (thread_args *)data;	args->info->threadid = SDL_ThreadID();	/* Figure out what function to run */	userfunc = args->func;	userdata = args->data;	statusloc = &args->info->status;	/* Wake up the parent thread */	SDL_SemPost(args->wait);	/* Run the function */	*statusloc = userfunc(userdata);}
开发者ID:Goettsch,项目名称:game-editor,代码行数:27,


示例2: rights

/* Subtype 0x0003 - BOS Rights. */static int rights(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	aim_rxcallback_t userfunc;	GSList *tlvlist;	guint16 maxpermits = 0, maxdenies = 0;	int ret = 0;	/*	 * TLVs follow	 */	tlvlist = aim_tlvlist_read(bs);	/*	 * TLV type 0x0001: Maximum number of buddies on permit list.	 */	if (aim_tlv_gettlv(tlvlist, 0x0001, 1))		maxpermits = aim_tlv_get16(tlvlist, 0x0001, 1);	/*	 * TLV type 0x0002: Maximum number of buddies on deny list.	 */	if (aim_tlv_gettlv(tlvlist, 0x0002, 1))		maxdenies = aim_tlv_get16(tlvlist, 0x0002, 1);	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))		ret = userfunc(od, conn, frame, maxpermits, maxdenies);	aim_tlvlist_free(tlvlist);	return ret;}
开发者ID:arminius2,项目名称:apolloim,代码行数:32,


示例3: keyparse

/* * Subtype 0x0007 * * Middle handler for 0017/0007 SNACs.  Contains the auth key prefixed * by only its length in a two byte word. * * Calls the client, which should then use the value to call aim_send_login. * */static intkeyparse(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	int keylen, ret = 1;	aim_rxcallback_t userfunc;	char *keystr;	GSList *tlvlist;	gboolean truncate_pass;	keylen = byte_stream_get16(bs);	keystr = byte_stream_getstr(bs, keylen);	tlvlist = aim_tlvlist_read(bs);	/*	 * If the truncate_pass TLV exists then we should truncate the	 * user's password to 8 characters.  This flag is sent to us	 * when logging in with an AOL user's username.	 */	truncate_pass = aim_tlv_gettlv(tlvlist, 0x0026, 1) != NULL;	/* XXX - When GiantGrayPanda signed on AIM I got a thing asking me to register	 * for the netscape network.  This SNAC had a type 0x0058 TLV with length 10.	 * Data is 0x0007 0004 3e19 ae1e 0006 0004 0000 0005 */	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))		ret = userfunc(od, conn, frame, keystr, (int)truncate_pass);	g_free(keystr);	aim_tlvlist_free(tlvlist);	return ret;}
开发者ID:Mons,项目名称:libpurple-mini,代码行数:41,


示例4: negchan_middle

static int negchan_middle(aim_session_t *sess, aim_frame_t *fr){	aim_tlvlist_t *tlvlist;	char *msg = NULL;	fu16_t code = 0;	aim_rxcallback_t userfunc;	int ret = 1;	if (aim_bstream_empty(&fr->data) == 0) {		/* XXX should do something with this */		return 1;	}	/* Used only by the older login protocol */	/* XXX remove this special case? */	if (fr->conn->type == AIM_CONN_TYPE_AUTH)		return consumenonsnac(sess, fr, 0x0017, 0x0003);	tlvlist = aim_tlvlist_read(&fr->data);	if (aim_tlv_gettlv(tlvlist, 0x0009, 1))		code = aim_tlv_get16(tlvlist, 0x0009, 1);	if (aim_tlv_gettlv(tlvlist, 0x000b, 1))		msg = aim_tlv_getstr(tlvlist, 0x000b, 1);	if ((userfunc = aim_callhandler(sess, fr->conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNERR)))		ret = userfunc(sess, fr, code, msg);	aim_tlvlist_free(&tlvlist);	free(msg);	return ret;}
开发者ID:echoline,项目名称:powk,代码行数:35,


示例5: incomingim_ch4

static int incomingim_ch4(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, guint16 channel, aim_userinfo_t *userinfo, aim_tlvlist_t *tlvlist, guint8 *cookie){	aim_bstream_t meat;	aim_rxcallback_t userfunc;	aim_tlv_t *block;	struct aim_incomingim_ch4_args args;	int ret = 0;	/*	 * Make a bstream for the meaty part.  Yum.  Meat.	 */	if (!(block = aim_gettlv(tlvlist, 0x0005, 1)))		return -1;	aim_bstream_init(&meat, block->value, block->length);	args.uin = aimbs_getle32(&meat);	args.type = aimbs_getle16(&meat);	args.msg = (char *)aimbs_getraw(&meat, aimbs_getle16(&meat));	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, channel, userinfo, &args);	g_free(args.msg);	return ret;}
开发者ID:GRMrGecko,项目名称:bitlbee,代码行数:26,


示例6: parsepopup

/* * This is all there is to it. * * The message is probably HTML. * */static int parsepopup(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){    aim_rxcallback_t userfunc;    aim_tlvlist_t *tl;    int ret = 0;    char *msg, *url;    fu16_t width, height, delay;    tl = aim_readtlvchain(bs);    msg = aim_gettlv_str(tl, 0x0001, 1);    url = aim_gettlv_str(tl, 0x0002, 1);    width = aim_gettlv16(tl, 0x0003, 1);    height = aim_gettlv16(tl, 0x0004, 1);    delay = aim_gettlv16(tl, 0x0005, 1);    if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))        ret = userfunc(sess, rx, msg, url, width, height, delay);    aim_freetlvchain(&tl);    free(msg);    free(url);    return ret;}
开发者ID:krattai,项目名称:transports,代码行数:31,


示例7: rights

/* Subtype 0x0003 - BOS Rights. */static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	aim_rxcallback_t userfunc;	aim_tlvlist_t *tlvlist;	fu16_t maxpermits = 0, maxdenies = 0;	int ret = 0;	/* 	 * TLVs follow 	 */	tlvlist = aim_readtlvchain(bs);	/*	 * TLV type 0x0001: Maximum number of buddies on permit list.	 */	if (aim_gettlv(tlvlist, 0x0001, 1))		maxpermits = aim_gettlv16(tlvlist, 0x0001, 1);	/*	 * TLV type 0x0002: Maximum number of buddies on deny list.	 */	if (aim_gettlv(tlvlist, 0x0002, 1)) 		maxdenies = aim_gettlv16(tlvlist, 0x0002, 1);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, maxpermits, maxdenies);	aim_freetlvchain(&tlvlist);	return ret;  }
开发者ID:BackupTheBerlios,项目名称:irssi-icq,代码行数:32,


示例8: buddychange

/* * Subtypes 0x000b (SNAC_SUBTYPE_BUDDY_ONCOMING) and 0x000c (SNAC_SUBTYPE_BUDDY_OFFGOING) - Change in buddy status * * Oncoming Buddy notifications contain a subset of the * user information structure.  It's close enough to run * through aim_info_extract() however. * * Although the offgoing notification contains no information, * it is still in a format parsable by aim_info_extract(). * */static intbuddychange(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	int ret = 0;	aim_userinfo_t userinfo;	aim_rxcallback_t userfunc;	aim_info_extract(od, bs, &userinfo);	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))		ret = userfunc(od, conn, frame, &userinfo);	if (snac->subtype == SNAC_SUBTYPE_BUDDY_ONCOMING &&	    userinfo.capabilities & OSCAR_CAPABILITY_XTRAZ) {		PurpleAccount *account = purple_connection_get_account(od->gc);		PurpleBuddy *buddy = purple_find_buddy(account, userinfo.bn);		if (buddy) {			PurplePresence *presence = purple_buddy_get_presence(buddy);			if (purple_presence_is_status_primitive_active(presence, PURPLE_STATUS_MOOD))				icq_im_xstatus_request(od, userinfo.bn);		}	}	aim_info_free(&userinfo);	return ret;}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:39,


示例9: parseicon

/** * Subtype 0x0005 - Receive a buddy icon. * * This is sent in response to a buddy icon request. */static int parseicon(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	int ret = 0;	aim_rxcallback_t userfunc;	char *sn;	fu16_t flags, iconlen;	fu8_t iconcsumtype, iconcsumlen, *iconcsum, *icon;	sn = aimbs_getstr(bs, aimbs_get8(bs));	flags = aimbs_get16(bs);	iconcsumtype = aimbs_get8(bs);	iconcsumlen = aimbs_get8(bs);	iconcsum = aimbs_getraw(bs, iconcsumlen);	iconlen = aimbs_get16(bs);	icon = aimbs_getraw(bs, iconlen);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, sn, iconcsumtype, iconcsum, iconcsumlen, icon, iconlen);	free(sn);	free(iconcsum);	free(icon);	return ret;}
开发者ID:BackupTheBerlios,项目名称:maemo-gaim-svn,代码行数:30,


示例10: userinfo

/* Subtype 0x0006 */static intuserinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	int ret = 0;	aim_rxcallback_t userfunc;	aim_userinfo_t *userinfo, *userinfo2;	GSList *tlvlist;	aim_tlv_t *tlv = NULL;	int was_explicit;	userinfo = (aim_userinfo_t *)g_malloc(sizeof(aim_userinfo_t));	aim_info_extract(od, bs, userinfo);	tlvlist = aim_tlvlist_read(bs);	/* Profile will be 1 and 2 */	userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1);	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) {		userinfo->info = (char *)g_malloc(tlv->length);		memcpy(userinfo->info, tlv->value, tlv->length);		userinfo->info_len = tlv->length;	}	/* Away message will be 3 and 4 */	userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1);	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) {		userinfo->away = (char *)g_malloc(tlv->length);		memcpy(userinfo->away, tlv->value, tlv->length);		userinfo->away_len = tlv->length;	}	/* Caps will be 5 */	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) {		ByteStream cbs;		byte_stream_init(&cbs, tlv->value, tlv->length);		userinfo->capabilities = aim_locate_getcaps(od, &cbs, tlv->length);		userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES;	}	aim_tlvlist_free(tlvlist);	aim_locate_adduserinfo(od, userinfo);	userinfo2 = aim_locate_finduserinfo(od, userinfo->sn);	aim_info_free(userinfo);	g_free(userinfo);	/*	 * Remove this screen name from our queue.  If the client requested	 * this buddy's info explicitly, then notify them that we have info	 * for this buddy.	 */	if (userinfo2 != NULL)	{		was_explicit = aim_locate_gotuserinfo(od, conn, userinfo2->sn);		if (was_explicit == TRUE)			if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))				ret = userfunc(od, conn, frame, userinfo2);	}	return ret;}
开发者ID:arminius2,项目名称:apolloim,代码行数:60,


示例11: aim_callhandler_noparam

faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn,fu16_t family, fu16_t type, aim_frame_t *ptr){	aim_rxcallback_t userfunc;	if ((userfunc = aim_callhandler(sess, conn, family, type)))		return userfunc(sess, ptr);	return 1; /* XXX */}
开发者ID:echoline,项目名称:powk,代码行数:9,


示例12: switch

/* * Get the base function */void OscilGen::getbasefunction(float *smps){    float par = (Pbasefuncpar + 0.5f) / 128.0f;    if(Pbasefuncpar == 64)        par = 0.5f;    float p1 = Pbasefuncmodulationpar1 / 127.0f,          p2 = Pbasefuncmodulationpar2 / 127.0f,          p3 = Pbasefuncmodulationpar3 / 127.0f;    switch(Pbasefuncmodulation) {        case 1:            p1 = (powf(2, p1 * 5.0f) - 1.0f) / 10.0f;            p3 = floor(powf(2, p3 * 5.0f) - 1.0f);            if(p3 < 0.9999f)                p3 = -1.0f;            break;        case 2:            p1 = (powf(2, p1 * 5.0f) - 1.0f) / 10.0f;            p3 = 1.0f + floor(powf(2, p3 * 5.0f) - 1.0f);            break;        case 3:            p1 = (powf(2, p1 * 7.0f) - 1.0f) / 10.0f;            p3 = 0.01f + (powf(2, p3 * 16.0f) - 1.0f) / 10.0f;            break;    }    base_func func = getBaseFunction(Pcurrentbasefunc);    for(int i = 0; i < synth.oscilsize; ++i) {        float t = i * 1.0f / synth.oscilsize;        switch(Pbasefuncmodulation) {            case 1: //rev                t = t * p3 + sinf((t + p2) * 2.0f * PI) * p1;                break;            case 2: //sine                t += sinf( (t * p3 + p2) * 2.0f * PI) * p1;                break;            case 3: //power                t += powf((1.0f - cosf((t + p2) * 2.0f * PI)) * 0.5f, p3) * p1;                break;            case 4: //chop                t = t * (powf(2.0, Pbasefuncmodulationpar1/32.0 +                              Pbasefuncmodulationpar2/2048.0)) + p3;        }        t = t - floor(t);        if(func)            smps[i] = func(t, par);        else if (Pcurrentbasefunc == 0)            smps[i] = -sinf(2.0f * PI * i / synth.oscilsize);        else            smps[i] = userfunc(t);    }}
开发者ID:fundamental,项目名称:Carla,代码行数:60,


示例13: userinfo

static int userinfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	aim_userinfo_t userinfo;	char *text_encoding = NULL, *text = NULL;	aim_rxcallback_t userfunc;	aim_tlvlist_t *tlvlist;	aim_snac_t *origsnac = NULL;	struct aim_priv_inforeq *inforeq;	int ret = 0;	origsnac = aim_remsnac(sess, snac->id);	if (!origsnac || !origsnac->data) {		faimdprintf(sess, 0, "parse_userinfo_middle: major problem: no snac stored!/n");		return 0;	}	inforeq = (struct aim_priv_inforeq *)origsnac->data;	if ((inforeq->infotype != AIM_GETINFO_GENERALINFO) &&			(inforeq->infotype != AIM_GETINFO_AWAYMESSAGE)) {		faimdprintf(sess, 0, "parse_userinfo_middle: unknown infotype in request! (0x%04x)/n", inforeq->infotype);		return 0;	}	aim_extractuserinfo(sess, bs, &userinfo);	tlvlist = aim_readtlvchain(bs);	/* 	 * Depending on what informational text was requested, different	 * TLVs will appear here.	 *	 * Profile will be 1 and 2, away message will be 3 and 4.	 */	if (aim_gettlv(tlvlist, 0x0001, 1)) {		text_encoding = aim_gettlv_str(tlvlist, 0x0001, 1);		text = aim_gettlv_str(tlvlist, 0x0002, 1);	} else if (aim_gettlv(tlvlist, 0x0003, 1)) {		text_encoding = aim_gettlv_str(tlvlist, 0x0003, 1);		text = aim_gettlv_str(tlvlist, 0x0004, 1);	}	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, &userinfo, text_encoding, text, inforeq->infotype);	free(text_encoding);	free(text);	aim_freetlvchain(&tlvlist);	if (origsnac)		free(origsnac->data);	free(origsnac);	return ret;}
开发者ID:Doap,项目名称:transports,代码行数:57,


示例14: aim_conn_completeconnect

/* * XXX this is nearly as ugly as proxyconnect(). */int aim_conn_completeconnect(aim_session_t *sess, aim_conn_t *conn){	fd_set fds, wfds;	struct timeval tv;	int res, error = ETIMEDOUT;	aim_rxcallback_t userfunc;	if (!conn || (conn->fd == -1))		return -1;	if (!(conn->status & AIM_CONN_STATUS_INPROGRESS))		return -1;	FD_ZERO(&fds);	FD_SET(conn->fd, &fds);	FD_ZERO(&wfds);	FD_SET(conn->fd, &wfds);	tv.tv_sec = 0;	tv.tv_usec = 0;	if ((res = select(conn->fd+1, &fds, &wfds, NULL, &tv)) == -1) {		error = errno;		aim_conn_close(conn);		errno = error;		return -1;	} else if (res == 0) {		return 0; /* hasn't really completed yet... */	} 	if (FD_ISSET(conn->fd, &fds) || FD_ISSET(conn->fd, &wfds)) {		socklen_t len = sizeof(error);		if (getsockopt(conn->fd, SOL_SOCKET, SO_ERROR, &error, &len) < 0)			error = errno;	}	if (error) {		aim_conn_close(conn);		errno = error;		return -1;	}	sock_make_blocking(conn->fd);	conn->status &= ~AIM_CONN_STATUS_INPROGRESS;	if ((userfunc = aim_callhandler(sess, conn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNCOMPLETE)))		userfunc(sess, NULL, conn);	/* Flush out the queues if there was something waiting for this conn  */	aim_tx_flushqueue(sess);	return 0;}
开发者ID:dequis,项目名称:bitlbee-old,代码行数:57,


示例15: got_securid_request

/** * Subtype 0x000a * * Receive SecurID request. */static intgot_securid_request(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	int ret = 0;	aim_rxcallback_t userfunc;	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype)))		ret = userfunc(od, conn, frame);	return ret;}
开发者ID:Mons,项目名称:libpurple-mini,代码行数:16,


示例16: goddamnicq

/* * Subtype 0x0007 (kind of) - Send a fake type 0x0007 SNAC to the client * * This is a bit confusing. * * Normal SNAC login goes like this: *   - connect *   - server sends flap version *   - client sends flap version *   - client sends username (17/6) *   - server sends hash key (17/7) *   - client sends auth request (17/2 -- aim_send_login) *   - server yells * * XOR login (for ICQ) goes like this: *   - connect *   - server sends flap version *   - client sends auth request which contains flap version (aim_send_login) *   - server yells * * For the client API, we make them implement the most complicated version, * and for the simpler version, we fake it and make it look like the more * complicated process. * * This is done by giving the client a faked key, just so we can convince * them to call aim_send_login right away, which will detect the session * flag that says this is XOR login and ignore the key, sending an ICQ * login request instead of the normal SNAC one. * * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. */static intgoddamnicq(OscarData *od, FlapConnection *conn, const char *sn){	FlapFrame frame;	aim_rxcallback_t userfunc;	if ((userfunc = aim_callhandler(od, SNAC_FAMILY_AUTH, 0x0007)))		userfunc(od, conn, &frame, "");	return 0;}
开发者ID:Mons,项目名称:libpurple-mini,代码行数:42,


示例17: buddychange

/* * Oncoming Buddy notifications contain a subset of the * user information structure.  Its close enough to run * through aim_extractuserinfo() however. * * Although the offgoing notification contains no information, * it is still in a format parsable by extractuserinfo. * */static int buddychange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	aim_userinfo_t userinfo;	aim_rxcallback_t userfunc;	aim_extractuserinfo(sess, bs, &userinfo);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		return userfunc(sess, rx, &userinfo);	return 0;}
开发者ID:GRMrGecko,项目名称:bitlbee,代码行数:21,


示例18: accountconfirm

static int accountconfirm(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,                          aim_bstream_t *bs){	aim_rxcallback_t userfunc;	guint16 status;	status = aimbs_get16(bs);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {		return userfunc(sess, rx, status);	}	return 0;}
开发者ID:AaronVanGeffen,项目名称:bitlbee,代码行数:14,


示例19: snachandler

static int snachandler(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){    if (snac->subtype == 0x0001)        return generror(sess, mod, rx, snac, bs);    else if ((snac->family == 0xffff) && (snac->subtype == 0xffff)) {        aim_rxcallback_t userfunc;        if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))            return userfunc(sess, rx);    }    return 0;}
开发者ID:shiplu,项目名称:bitlbee,代码行数:14,


示例20: reportinterval

static int reportinterval(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac,                          aim_bstream_t *bs){    guint16 interval;    aim_rxcallback_t userfunc;    interval = aimbs_get16(bs);    if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {        return userfunc(sess, rx, interval);    }    return 0;}
开发者ID:carriercomm,项目名称:bitlbee,代码行数:14,


示例21: userinfo

/* Subtype 0x0006 */static intuserinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	int ret = 0;	aim_rxcallback_t userfunc;	aim_userinfo_t *userinfo, *userinfo2;	GSList *tlvlist;	aim_tlv_t *tlv = NULL;	userinfo = (aim_userinfo_t *)g_malloc(sizeof(aim_userinfo_t));	aim_info_extract(od, bs, userinfo);	tlvlist = aim_tlvlist_read(bs);	/* Profile will be 1 and 2 */	userinfo->info_encoding = aim_tlv_getstr(tlvlist, 0x0001, 1);	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0002, 1))) {		userinfo->info = (char *)g_malloc(tlv->length);		memcpy(userinfo->info, tlv->value, tlv->length);		userinfo->info_len = tlv->length;	}	/* Away message will be 3 and 4 */	userinfo->away_encoding = aim_tlv_getstr(tlvlist, 0x0003, 1);	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0004, 1))) {		userinfo->away = (char *)g_malloc(tlv->length);		memcpy(userinfo->away, tlv->value, tlv->length);		userinfo->away_len = tlv->length;	}	/* Caps will be 5 */	if ((tlv = aim_tlv_gettlv(tlvlist, 0x0005, 1))) {		ByteStream cbs;		byte_stream_init(&cbs, tlv->value, tlv->length);		userinfo->capabilities = aim_locate_getcaps(od, &cbs, tlv->length);		userinfo->present = AIM_USERINFO_PRESENT_CAPABILITIES;	}	aim_tlvlist_free(tlvlist);	aim_locate_adduserinfo(od, userinfo);	userinfo2 = aim_locate_finduserinfo(od, userinfo->bn);	aim_info_free(userinfo);	g_free(userinfo);	/* Show the info to the user */	if (userinfo2 != NULL && ((userfunc = aim_callhandler(od, snac->family, snac->subtype))))		ret = userfunc(od, conn, frame, userinfo2);	return ret;}
开发者ID:psunkari,项目名称:spicebird,代码行数:50,


示例22: goddamnicq

/* * This is a bit confusing. * * Normal SNAC login goes like this: *   - connect *   - server sends flap version *   - client sends flap version *   - client sends screen name (17/6) *   - server sends hash key (17/7) *   - client sends auth request (17/2 -- aim_send_login) *   - server yells * * XOR login (for ICQ) goes like this: *   - connect *   - server sends flap version *   - client sends auth request which contains flap version (aim_send_login) *   - server yells * * For the client API, we make them implement the most complicated version, * and for the simpler version, we fake it and make it look like the more * complicated process. * * This is done by giving the client a faked key, just so we can convince * them to call aim_send_login right away, which will detect the session * flag that says this is XOR login and ignore the key, sending an ICQ * login request instead of the normal SNAC one. * * As soon as AOL makes ICQ log in the same way as AIM, this is /gone/. * * XXX This may cause problems if the client relies on callbacks only * being called from the context of aim_rxdispatch()... * */static int goddamnicq(aim_session_t *sess, aim_conn_t *conn, const char *sn){	aim_frame_t fr;	aim_rxcallback_t userfunc;		sess->flags &= ~AIM_SESS_FLAGS_SNACLOGIN;	sess->flags |= AIM_SESS_FLAGS_XORLOGIN;	fr.conn = conn;		if ((userfunc = aim_callhandler(sess, conn, 0x0017, 0x0007)))		userfunc(sess, &fr, "");	return 0;}
开发者ID:jianingy,项目名称:bitlbee-clone,代码行数:48,


示例23: infochange

/* called for both reply and change-reply */static int infochange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	/*	 * struct {	 *    guint16 perms;	 *    guint16 tlvcount;	 *    aim_tlv_t tlvs[tlvcount];	 *  } admin_info[n];	 */	while (aim_bstream_empty(bs)) {		guint16 perms, tlvcount;		perms = aimbs_get16(bs);		tlvcount = aimbs_get16(bs);		while (tlvcount && aim_bstream_empty(bs)) {			aim_rxcallback_t userfunc;			guint16 type, len;			guint8 *val;			int str = 0;			type = aimbs_get16(bs);			len = aimbs_get16(bs);			if ((type == 0x0011) || (type == 0x0004)) {				str = 1;			}			if (str) {				val = (guint8 *) aimbs_getstr(bs, len);			} else {				val = aimbs_getraw(bs, len);			}			/* XXX fix so its only called once for the entire packet */			if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype))) {				userfunc(sess, rx, (snac->subtype == 0x0005) ? 1 : 0, perms, type, len, val, str);			}			g_free(val);			tlvcount--;		}	}	return 1;}
开发者ID:AaronVanGeffen,项目名称:bitlbee,代码行数:49,


示例24: keyparse

/* * Middle handler for 0017/0007 SNACs.  Contains the auth key prefixed * by only its length in a two byte word. * * Calls the client, which should then use the value to call aim_send_login. * */static int keyparse(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	int keylen, ret = 1;	aim_rxcallback_t userfunc;	char *keystr;	keylen = aimbs_get16(bs);	keystr = aimbs_getstr(bs, keylen);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, keystr);	g_free(keystr); 	return ret;}
开发者ID:jianingy,项目名称:bitlbee-clone,代码行数:23,


示例25: uploadack

/** * Subtype 0x0003 - Acknowledgement for uploading a buddy icon. * * You get this honky after you upload a buddy icon. */static int uploadack(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	int ret = 0;	aim_rxcallback_t userfunc;	fu16_t something, somethingelse;	fu8_t onemorething;	something = aimbs_get16(bs);	somethingelse = aimbs_get16(bs);	onemorething = aimbs_get8(bs);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx);	return ret;}
开发者ID:BackupTheBerlios,项目名称:maemo-gaim-svn,代码行数:21,


示例26: paraminfo

static int paraminfo(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	struct aim_icbmparameters params;	aim_rxcallback_t userfunc;	params.maxchan = aimbs_get16(bs);	params.flags = aimbs_get32(bs);	params.maxmsglen = aimbs_get16(bs);	params.maxsenderwarn = aimbs_get16(bs);	params.maxrecverwarn = aimbs_get16(bs);	params.minmsginterval = aimbs_get32(bs);		if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		return userfunc(sess, rx, &params);	return 0;}
开发者ID:GRMrGecko,项目名称:bitlbee,代码行数:17,


示例27: buddychange

/* * Subtypes 0x000b and 0x000c - Change in buddy status * * Oncoming Buddy notifications contain a subset of the * user information structure.  It's close enough to run * through aim_info_extract() however. * * Although the offgoing notification contains no information, * it is still in a format parsable by aim_info_extract(). * */static int buddychange(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx, aim_modsnac_t *snac, aim_bstream_t *bs){	int ret = 0;	aim_userinfo_t userinfo;	aim_rxcallback_t userfunc;	aim_info_extract(sess, bs, &userinfo);	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family, snac->subtype)))		ret = userfunc(sess, rx, &userinfo);	if (snac->subtype == 0x000b)		aim_locate_requestuserinfo(sess, userinfo.sn);	aim_info_free(&userinfo);	return ret;}
开发者ID:echoline,项目名称:powk,代码行数:28,


示例28: aim_conn_close

/** * aim_conn_close - Close a connection * @deadconn: Connection to close * * Close (but not free) a connection. * * This leaves everything untouched except for clearing the  * handler list and setting the fd to -1 (used to recognize * dead connections).  It will also remove cookies if necessary. * */faim_export void aim_conn_close(aim_conn_t *deadconn){	aim_rxcallback_t userfunc;	if (deadconn->fd >= 3)		close(deadconn->fd);	deadconn->fd = -1;	if ((userfunc = aim_callhandler(deadconn->sessv, deadconn, AIM_CB_FAM_SPECIAL, AIM_CB_SPECIAL_CONNDEAD)))		userfunc(deadconn->sessv, NULL, deadconn);	if (deadconn->handlerlist)		aim_clearhandlers(deadconn);	return;}
开发者ID:BackupTheBerlios,项目名称:irssi-icq,代码行数:28,


示例29: infoupdate

/* * Subtype 0x0002 - General room information.  Lots of stuff. * * Values I know are in here but I haven't attached * them to any of the 'Unknown's: *	- Language (English) * */static intinfoupdate(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs){	aim_rxcallback_t userfunc;	int ret = 0;	guint8 detaillevel = 0;	struct aim_chat_roominfo roominfo;	GSList *tlvlist;	guint16 maxmsglen, maxvisiblemsglen;	aim_chat_readroominfo(bs, &roominfo);	detaillevel = byte_stream_get8(bs);	if (detaillevel != 0x02) {		purple_debug_misc("oscar", "faim: chat_roomupdateinfo: detail level %d not supported/n", detaillevel);		return 1;	}	byte_stream_get16(bs); /* skip the TLV count */	/*	 * Everything else are TLVs.	 */	tlvlist = aim_tlvlist_read(bs);	/*	 * Type 0x00d1: Maximum Message Length	 */	maxmsglen = aim_tlv_get16(tlvlist, 0x00d1, 1);	/*	 * Type 0x00da: Maximum visible message length	 */	maxvisiblemsglen = aim_tlv_get16(tlvlist, 0x00da, 1);	if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) {		ret = userfunc(od, conn, frame, maxmsglen, maxvisiblemsglen);	}	g_free(roominfo.name);	aim_tlvlist_free(tlvlist);	return ret;}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:54,


示例30: rights

/* * Subtype 0x0003 - Rights. * */static int rights(aim_session_t *sess, aim_module_t *mod, aim_frame_t *rx,	aim_modsnac_t *snac, aim_bstream_t *bs){	aim_rxcallback_t userfunc;	aim_tlvlist_t *tlvlist;	fu16_t maxbuddies = 0, maxwatchers = 0;	int ret = 0;	/* 	 * TLVs follow 	 */	tlvlist = aim_readtlvchain(bs);	/*	 * TLV type 0x0001: Maximum number of buddies.	 */	if (aim_gettlv(tlvlist, 0x0001, 1))		maxbuddies = aim_gettlv16(tlvlist, 0x0001, 1);	/*	 * TLV type 0x0002: Maximum number of watchers.	 *	 * Watchers are other users who have you on their buddy	 * list.  (This is called the "reverse list" by a certain	 * other IM protocol.)	 * 	 */	if (aim_gettlv(tlvlist, 0x0002, 1))		maxwatchers = aim_gettlv16(tlvlist, 0x0002, 1);	/*	 * TLV type 0x0003: Unknown.	 *	 * ICQ only?	 */	if ((userfunc = aim_callhandler(sess, rx->conn, snac->family,				snac->subtype)))		ret = userfunc(sess, rx, maxbuddies, maxwatchers);	aim_freetlvchain(&tlvlist);	return ret;}
开发者ID:ayttm,项目名称:ayttm,代码行数:48,



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


C++ userlist_find函数代码示例
C++ user_strdup函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。