Beispiel #1
0
void qun_msg_callback ( qqclient* qq, uint uid, uint int_uid,
	time_t t, char* msg )
{
	qqqun* q;
	char timestr[24];
	struct tm * timeinfo, * tmnow;
	char* str;
	int len, d1, d2;
	time_t t_now;
	t_now = time(NULL);
  	tmnow = localtime( &t_now );
  	d1 = tmnow->tm_mday;
  	timeinfo = localtime ( &t );
  	d2 = timeinfo->tm_mday;
  	if( d1 != d2 ){
		strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	}else{
		strftime( timestr, 24, "%H:%M:%S", timeinfo );
	}
	q = qun_get( qq, int_uid, 1 );
	if( !q ){
		DBG (("error: q=NULL"));
		return;
	}
	len = strlen( msg );
	NEW( char *, str, len+64 );
	sprintf( str, "clustermsg^$%u^$%u^$%s^$%s", q->ext_number, uid, timestr, msg );
	qqclient_put_message( qq, str );
}
Beispiel #2
0
void buddy_msg_callback ( qqclient* qq, uint uid, time_t t, char* msg )
{
	char timestr[24];
	struct tm * timeinfo, * tmnow;
	char* str;
	int len, d1, d2;
	time_t t_now;
	t_now = time(NULL);
  	tmnow = localtime( &t_now );
  	d1 = tmnow->tm_mday;
  	timeinfo = localtime ( &t );
  	d2 = timeinfo->tm_mday;
  	if( d1 != d2 ){
		strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	}else{
		strftime( timestr, 24, "%H:%M:%S", timeinfo );
	}
	len = strlen( msg );
	NEW( char *, str, len+64 );
	if( uid == 10000 ){
		sprintf( str, "broadcast^$System^$%s", msg );
	}else{
		sprintf( str, "buddymsg^$%u^$%s^$%s", uid, timestr, msg );
	}
	qqclient_put_message( qq, str );
}
Beispiel #3
0
void buddy_msg_callback ( qqclient* qq, uint uid, time_t t, char* msg )
{
	char timestr[24];
	struct tm * timeinfo;
	char* str;
	int len;
  	timeinfo = localtime ( &t );
	strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	len = strlen( msg );
	NEW( str, len+64 );
	if( uid == 10000 ){
		sprintf( str, "broadcast^$System^$%s", msg );
	}else{
		sprintf( str, "buddymsg^$%u^$%s^$%s", uid, timestr, msg );
	}
	qqclient_put_message( qq, str );
}
Beispiel #4
0
void qun_msg_callback ( qqclient* qq, uint uid, uint int_uid,
	time_t t, char* msg )
{
	qqqun* q;
	char timestr[24];
	struct tm * timeinfo;
	char* str;
	int len;
  	timeinfo = localtime ( &t );
	strftime( timestr, 24, "%Y-%m-%d %H:%M:%S", timeinfo );
	q = qun_get( qq, int_uid, 1 );
	if( !q ){
		DBG("error: q=NULL");
		return;
	}
	len = strlen( msg );
	NEW( str, len+64 );
	sprintf( str, "clustermsg^$%u^$%u^$%s^$%s", q->ext_number, uid, timestr, msg );
	qqclient_put_message( qq, str );
}