当前位置: 首页>>代码示例>>Java>>正文


Java DelayInfo类代码示例

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


DelayInfo类属于org.jivesoftware.smackx.packet包,在下文中一共展示了DelayInfo类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: sendOfflineMessages

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
public void sendOfflineMessages() {
	Cursor cursor = mContentResolver.query(ChatProvider.CONTENT_URI,
			SEND_OFFLINE_PROJECTION, SEND_OFFLINE_SELECTION,
			null, null);
	final int      _ID_COL = cursor.getColumnIndexOrThrow(ChatConstants._ID);
	final int      JID_COL = cursor.getColumnIndexOrThrow(ChatConstants.JID);
	final int      MSG_COL = cursor.getColumnIndexOrThrow(ChatConstants.MESSAGE);
	final int       TS_COL = cursor.getColumnIndexOrThrow(ChatConstants.DATE);
	final int PACKETID_COL = cursor.getColumnIndexOrThrow(ChatConstants.PACKET_ID);
	ContentValues mark_sent = new ContentValues();
	mark_sent.put(ChatConstants.DELIVERY_STATUS, ChatConstants.DS_SENT_OR_READ);
	while (cursor.moveToNext()) {
		int _id = cursor.getInt(_ID_COL);
		String toJID = cursor.getString(JID_COL);
		String message = cursor.getString(MSG_COL);
		String packetID = cursor.getString(PACKETID_COL);
		long ts = cursor.getLong(TS_COL);
		Log.d(TAG, "sendOfflineMessages: " + toJID + " > " + message);
		final Message newMessage = new Message(toJID, Message.Type.chat);
		newMessage.setBody(message);
		DelayInformation delay = new DelayInformation(new Date(ts));
		newMessage.addExtension(delay);
		newMessage.addExtension(new DelayInfo(delay));
		newMessage.addExtension(new DeliveryReceiptRequest());
		if ((packetID != null) && (packetID.length() > 0)) {
			newMessage.setPacketID(packetID);
		} else {
			packetID = newMessage.getPacketID();
			mark_sent.put(ChatConstants.PACKET_ID, packetID);
		}
		Uri rowuri = Uri.parse("content://" + ChatProvider.AUTHORITY
			+ "/" + ChatProvider.TABLE_NAME + "/" + _id);
		mContentResolver.update(rowuri, mark_sent,
					null, null);
		mXMPPConnection.sendPacket(newMessage);		// must be after marking delivered, otherwise it may override the SendFailListener
	}
	cursor.close();
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:39,代码来源:SmackableImp.java

示例2: parseExtension

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
@Override
public PacketExtension parseExtension(XmlPullParser parser) throws Exception
{
	return new DelayInfo((DelayInformation)super.parseExtension(parser));
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:6,代码来源:DelayInfoProvider.java

示例3: sendOfflineMessages

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
/***************** start 发送离线消息 ***********************/
public void sendOfflineMessages() {
	Cursor cursor = mContentResolver.query(ChatProvider.CONTENT_URI,
			SEND_OFFLINE_PROJECTION, SEND_OFFLINE_SELECTION, null, null);// 查询数据库获取离线消息游标
	final int _ID_COL = cursor.getColumnIndexOrThrow(ChatConstants._ID);
	final int JID_COL = cursor.getColumnIndexOrThrow(ChatConstants.JID);
	final int MSG_COL = cursor.getColumnIndexOrThrow(ChatConstants.MESSAGE);
	final int TS_COL = cursor.getColumnIndexOrThrow(ChatConstants.DATE);
	final int PACKETID_COL = cursor
			.getColumnIndexOrThrow(ChatConstants.PACKET_ID);
	ContentValues mark_sent = new ContentValues();
	mark_sent.put(ChatConstants.DELIVERY_STATUS,
			ChatConstants.DS_SENT_OR_READ);
	while (cursor.moveToNext()) {// 遍历之后将离线消息发出
		int _id = cursor.getInt(_ID_COL);
		String toJID = cursor.getString(JID_COL);
		String message = cursor.getString(MSG_COL);
		String packetID = cursor.getString(PACKETID_COL);
		long ts = cursor.getLong(TS_COL);
		L.d("sendOfflineMessages: " + toJID + " > " + message);
		final Message newMessage = new Message(toJID, Message.Type.chat);
		newMessage.setBody(message);
		DelayInformation delay = new DelayInformation(new Date(ts));
		newMessage.addExtension(delay);
		newMessage.addExtension(new DelayInfo(delay));
		newMessage.addExtension(new DeliveryReceiptRequest());
		if ((packetID != null) && (packetID.length() > 0)) {
			newMessage.setPacketID(packetID);
		} else {
			packetID = newMessage.getPacketID();
			mark_sent.put(ChatConstants.PACKET_ID, packetID);
		}
		Uri rowuri = Uri.parse("content://" + ChatProvider.AUTHORITY + "/"
				+ ChatProvider.TABLE_NAME + "/" + _id);
		// 将消息标记为已发送再调用发送,因为,假设此消息又未发送成功,有SendFailListener重新标记消息
		mContentResolver.update(rowuri, mark_sent, null, null);
		mXMPPConnection.sendPacket(newMessage); // must be after marking
												// delivered, otherwise it
												// may override the
												// SendFailListener
	}
	cursor.close();
}
 
开发者ID:victoryckl,项目名称:XmppTest,代码行数:44,代码来源:SmackImpl.java

示例4: parseExtension

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
@Override
public PacketExtension parseExtension(XmlPullParser parser)
		throws Exception {
	return new DelayInfo((DelayInformation) super.parseExtension(parser));
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:6,代码来源:DelayInfoProvider.java

示例5: sendOfflineMessages

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
/***************** start 发送离线消息 ***********************/
public void sendOfflineMessages() {
	Cursor cursor = mContentResolver.query(ChatProvider.CONTENT_URI,
			SEND_OFFLINE_PROJECTION, SEND_OFFLINE_SELECTION, null, null);// 查询数据库获取离线消息游标
	final int _ID_COL = cursor.getColumnIndexOrThrow(ChatConstants._ID);
	final int JID_COL = cursor.getColumnIndexOrThrow(ChatConstants.JID);
	final int MSG_COL = cursor.getColumnIndexOrThrow(ChatConstants.MESSAGE);
	final int TS_COL = cursor.getColumnIndexOrThrow(ChatConstants.DATE);
	final int PACKETID_COL = cursor
			.getColumnIndexOrThrow(ChatConstants.PACKET_ID);
	ContentValues mark_sent = new ContentValues();
	mark_sent.put(ChatConstants.DELIVERY_STATUS,
			ChatConstants.DS_SENT_OR_READ);
	while (cursor.moveToNext()) {// 遍历之后将离线消息发出
		int _id = cursor.getInt(_ID_COL);
		String toJID = cursor.getString(JID_COL);
		String message = cursor.getString(MSG_COL);
		String packetID = cursor.getString(PACKETID_COL);
		long ts = cursor.getLong(TS_COL);
		AppLogger.d("sendOfflineMessages: " + toJID + " > " + message);
		final Message newMessage = new Message(toJID, Message.Type.chat);
		newMessage.setBody(message);
		DelayInformation delay = new DelayInformation(new Date(ts));
		newMessage.addExtension(delay);
		newMessage.addExtension(new DelayInfo(delay));
		newMessage.addExtension(new DeliveryReceiptRequest());
		if ((packetID != null) && (packetID.length() > 0)) {
			newMessage.setPacketID(packetID);
		} else {
			packetID = newMessage.getPacketID();
			mark_sent.put(ChatConstants.PACKET_ID, packetID);
		}
		Uri rowuri = Uri.parse("content://" + ChatProvider.AUTHORITY + "/"
				+ ChatProvider.TABLE_NAME + "/" + _id);
		// 将消息标记为已发送再调用发送,因为,假设此消息又未发送成功,有SendFailListener重新标记消息
		mContentResolver.update(rowuri, mark_sent, null, null);
		mXMPPConnection.sendPacket(newMessage); // must be after marking
												// delivered, otherwise it
												// may override the
												// SendFailListener
	}
	cursor.close();
}
 
开发者ID:misty-rain,项目名称:smartedu,代码行数:44,代码来源:SmackImpl.java

示例6: Forwarded

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
/**
 * Creates a new Forwarded packet extension.
 *
 * @param delay an optional {@link DelayInfo} timestamp of the packet.
 * @param fwdPacket the packet that is forwarded (required).
 */
public Forwarded(DelayInfo delay, Packet fwdPacket) {
    this.delay = delay;
    this.forwardedPacket = fwdPacket;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:11,代码来源:Forwarded.java

示例7: getDelayInfo

import org.jivesoftware.smackx.packet.DelayInfo; //导入依赖的package包/类
/**
 * get the timestamp of the forwarded packet.
 *
 * @return the {@link DelayInfo} representing the time when the original packet was sent. May be null.
 */
public DelayInfo getDelayInfo() {
    return delay;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:9,代码来源:Forwarded.java


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