⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionlistener.java.svn-base

📁 类似QQ的功能
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
						// Skip EXTMSG.UNKNOWN and EXTMSG.LEN						msg2Marker += 15 + 4;						// Get length of text						textLen = (int) Util.getDWord(msg2Buf, msg2Marker,								false);						msg2Marker += 4;						// Check length						if (msg2Buf.length < msg2Marker + textLen)						{							throw (new JimmException(152, 7, false));						}						// Get text						String text = Util.removeCr(Util.byteArrayToString(								msg2Buf, msg2Marker, textLen));						msg2Marker += textLen;//#sijapp cond.if (target != "DEFAULT") & (modules_FILES = "true")#						// File transfer message						if (plugin.equals("File")								&& Jimm.jimm.getSplashCanvasRef().isShown())						{							if (ackType == 2)							{								// Get the port we should connect to								port = Integer.toString(Util.getWord(msg2Buf,										msg2Marker));								msg2Marker += 2;								// Skip unknwon stuff								msg2Marker += 2;								// Get filename								textLen = Util.getWord(msg2Buf, msg2Marker,										false);								msg2Marker += 2;								// Check length								if (msg2Buf.length < msg2Marker + textLen)								{									throw (new JimmException(152, 8, false));								}								// Get text								/*String filename = */ Util.removeCr(Util										.byteArrayToString(msg2Buf, msg2Marker,												textLen));								msg2Marker += textLen;								// Get filesize								/*long filesize = */ Util.getDWord(msg2Buf,										msg2Marker, false);								msg2Marker += 4;								// Get IP if possible								// Check length								//System.out.println("msgBuf len: "+msgBuf.length+" msgMarker: "+msgMarker);								if (msgBuf.length < +8)								{									throw (new JimmException(152, 9, false));								}								msg2Buf = Util.getTlv(msgBuf, msgMarker);								if (msg2Buf == null)								{									throw (new JimmException(152, 2, false));								}								tlvType = Util.getWord(msgBuf, msgMarker);								if (tlvType == 0x0004)									System.arraycopy(msg2Buf, 0, ip, 0, 4);								msgMarker += 4 + msg2Buf.length;								ContactItem sender = ContactList										.getItembyUIN(uin);								sender										.setBytesArray(												ContactItem.CONTACTITEM_INTERNAL_IP,												ip);								sender										.setBytesArray(												ContactItem.CONTACTITEM_EXTERNAL_IP,												extIP);								sender										.setIntValue(												ContactItem.CONTACTITEM_DC_PORT,												Integer.parseInt(port));								//System.out.println("Filetransfer ack: "+text+" "+filename+" "+filesize+" "+Util.ipToString(ip)+" "+Util.ipToString(extIP)+" "+port);								DirectConnectionAction dcAct = new DirectConnectionAction(										FileTransfer.getFTM());								try								{									Icq.requestAction(dcAct);								} catch (JimmException e)								{									JimmException.handleException(e);									if (e.isCritical())										return;								}								// Start timer (timer will activate splash screen)								SplashCanvas.addTimerTask("filetransfer",										dcAct, true);							}						}						// URL message						else						//#sijapp cond.end#						if (plugin.equals("Send Web Page Address (URL)"))						{							// Search for delimiter							int delim = text.indexOf(0xFE);							// Split message, if delimiter could be found							String urlText;							String url;							if (delim != -1)							{								urlText = text.substring(0, delim);								url = text.substring(delim + 1);							} else							{								urlText = text;								url = "";							}							// Forward message message to contact list							UrlMessage message = new UrlMessage(uin, Options									.getString(Options.OPTION_UIN), Util									.createCurrentDate(false), url, urlText);							MainThread.addMessageSerially(message);							// Acknowledge message							byte[] ackBuf = new byte[10 + 1 + uinLen + 2 + 51									+ 3 + 20 + 4 + (int) pluginLen + 19 + 4									+ textLen];							int ackMarker = 0;							System.arraycopy(buf, 0, ackBuf, ackMarker, 10);							ackMarker += 10;							Util.putByte(ackBuf, ackMarker, uinLen);							ackMarker += 1;							byte[] uinRaw = Util.stringToByteArray(uin);							System.arraycopy(uinRaw, 0, ackBuf, ackMarker,									uinRaw.length);							ackMarker += uinRaw.length;							Util.putWord(ackBuf, ackMarker, 0x0003);							ackMarker += 2;							System.arraycopy(msgBuf, 0, ackBuf, ackMarker, 51);							ackMarker += 51;							Util.putWord(ackBuf, ackMarker, 0x0001, false);							ackMarker += 2;							Util.putByte(ackBuf, ackMarker, 0x00);							ackMarker += 1;							System.arraycopy(msg2Buf, extDataStart, ackBuf,									ackMarker, 20 + 4 + (int) pluginLen + 19											+ 4 + textLen);							SnacPacket ackPacket = new SnacPacket(									SnacPacket.CLI_ACKMSG_FAMILY,									SnacPacket.CLI_ACKMSG_COMMAND, 0,									new byte[0], ackBuf);							Icq.sendPacket(ackPacket);						}						// Other messages						else						{							// Discard						}					}					// Status message requests					else if (((msgType >= 1000) && (msgType <= 1004)))					{						String statusMess = "---";						int currStatus = (int)Options.getLong(Options.OPTION_ONLINE_STATUS);						StatusInfo statInfo = JimmUI.findStatus(StatusInfo.TYPE_STATUS, currStatus);												if (statInfo.testFlag(StatusInfo.FLAG_HAVE_DESCR))						{							statusMess = Options.getStatusString(StatusInfo.TYPE_STATUS, currStatus);							statusMess = (statusMess != null) ? Util.replaceStr(statusMess, "%TIME%", Icq.getLastStatusChangeTime()) : "---";						}						// Acknowledge message with away message						final byte[] statusMessBytes = Util.stringToByteArray(statusMess, false);						if (statusMessBytes.length < 1) return;						byte[] ackBuf = new byte[10 + 1 + uinLen + 2 + 51 + 2								+ statusMessBytes.length + 1];						int ackMarker = 0;						System.arraycopy(buf, 0, ackBuf, ackMarker, 10);						ackMarker += 10;						Util.putByte(ackBuf, ackMarker, uinLen);						ackMarker += 1;						byte[] uinRaw = Util.stringToByteArray(uin);						System.arraycopy(uinRaw, 0, ackBuf, ackMarker,								uinRaw.length);						ackMarker += uinRaw.length;						Util.putWord(ackBuf, ackMarker, 0x0003);						ackMarker += 2;						System.arraycopy(msg2Buf, 0, ackBuf, ackMarker, 51);						Util.putWord(ackBuf, ackMarker + 2, 0x0800);						ackMarker += 51;						Util.putWord(ackBuf, ackMarker,								statusMessBytes.length + 1, false);						ackMarker += 2;						System.arraycopy(statusMessBytes, 0, ackBuf, ackMarker,								statusMessBytes.length);						Util.putByte(ackBuf,								ackMarker + statusMessBytes.length, 0x00);						SnacPacket ackPacket = new SnacPacket(								SnacPacket.CLI_ACKMSG_FAMILY,								SnacPacket.CLI_ACKMSG_COMMAND, 0, new byte[0],								ackBuf);						Icq.sendPacket(ackPacket);					}				}				//////////////////////				// Message format 4 //				//////////////////////				else if (format == 0x0004)				{					// Check length					if (msgBuf.length < 8)					{						throw (new JimmException(153, 0, false));					}					// Skip SUB_MSG_TYPE4.UIN					msgMarker += 4;					// Get SUB_MSG_TYPE4.MSGTYPE					int msgType = Util.getWord(msgBuf, msgMarker, false);					msgMarker += 2;					// Only plain messages and URL messagesa are supported					if ((msgType != 0x0001) && (msgType != 0x0004))						return;					// Get length of text					int textLen = Util.getWord(msgBuf, msgMarker, false);					msgMarker += 2;					// Check length (exact match required)					if (msgBuf.length != 8 + textLen)					{						throw (new JimmException(153, 1, false));					}					// Get text					String text = Util.removeCr(Util.byteArrayToString(msgBuf,							msgMarker, textLen));					msgMarker += textLen;					// Plain message					if (msgType == 0x0001)					{						// Forward message to contact list						PlainMessage plainMsg = new PlainMessage(uin, Options								.getString(Options.OPTION_UIN), Util								.createCurrentDate(false), text, false);						MainThread.addMessageSerially(plainMsg);					}					// URL message					else if (msgType == 0x0004)					{						// Search for delimiter						int delim = text.indexOf(0xFE);						// Split message, if delimiter could be found						String urlText;						String url;						if (delim != -1)						{							urlText = text.substring(0, delim);							url = text.substring(delim + 1);						} else						{							urlText = text;							url = "";						}						// Forward message message to contact list						UrlMessage urlMsg = new UrlMessage(uin, Options								.getString(Options.OPTION_UIN), Util								.createCurrentDate(false), url, urlText);						MainThread.addMessageSerially(urlMsg);					}				}			}			//	  Watch out for SRV_ADDEDYOU			else if ((snacPacket.getFamily() == SnacPacket.SRV_ADDEDYOU_FAMILY)					&& (snacPacket.getCommand() == SnacPacket.SRV_ADDEDYOU_COMMAND))			{				// Get data				byte[] buf = snacPacket.getData();				// Get UIN of the contact changing status				int uinLen = Util.getByte(buf, 0);				String uin = Util.byteArrayToString(buf, 1, uinLen);				// Create a new system notice				SystemNotice notice = new SystemNotice(						SystemNotice.SYS_NOTICE_YOUWEREADDED, uin, false, null);				// Handle the new system notice				MainThread.addMessageSerially(notice);			}			//	  Watch out for SRV_AUTHREQ			else if ((snacPacket.getFamily() == SnacPacket.SRV_AUTHREQ_FAMILY)					&& (snacPacket.getCommand() == SnacPacket.SRV_AUTHREQ_COMMAND))			{				int authMarker = 0;				// Get data				byte[] buf = snacPacket.getData();				// Get UIN of the contact changing status				int length = Util.getByte(buf, 0);				authMarker += 1;				String uin = Util.byteArrayToString(buf, authMarker, length);				authMarker += length;				// Get reason				length = Util.getWord(buf, authMarker);				authMarker += 2;				String reason = Util.byteArrayToString(buf, authMarker, length,						Util.isDataUTF8(buf, authMarker, length));				// Create a new system notice				SystemNotice notice = new SystemNotice(						SystemNotice.SYS_NOTICE_AUTHREQ, uin, false, reason);				// Handle the new system notice				MainThread.addMessageSerially(notice);			}			//	  Watch out for SRV_AUTHREPLY			else if ((snacPacket.getFamily() == SnacPacket.SRV_AUTHREPLY_FAMILY)					&& (snacPacket.getCommand() == SnacPacket.SRV_AUTHREPLY_COMMAND))			{				int authMarker = 0;				// Get data				byte[] buf = snacPacket.getData();				// Get UIN of the contact changing status				int length = Util.getByte(buf, 0);				authMarker += 1;				String uin = Util.byteArrayToString(buf, authMarker, length);				authMarker += length;				// Get granted boolean				boolean granted = false;				if (Util.getByte(buf, authMarker) == 0x01)				{					granted = true;				}				authMarker += 1;				// Get reason only of not granted				SystemNotice notice;				if (!granted)				{					length = Util.getWord(buf, authMarker);					String reason = Util.byteArrayToString(buf, authMarker,							length + 2);					// Create a new system notice					if (length == 0)						notice = new SystemNotice(								SystemNotice.SYS_NOTICE_AUTHREPLY, uin,								granted, null);					else						notice = new SystemNotice(								SystemNotice.SYS_NOTICE_AUTHREPLY, uin,								granted, reason);				} else				{					// Create a new system notice					//System.out.println("Auth granted");					notice = new SystemNotice(							SystemNotice.SYS_NOTICE_AUTHREPLY, uin, granted, "");				}				// Handle the new system notice				MainThread.addMessageSerially(notice);			}						else if ((snacPacket.getFamily() == SnacPacket.SRV_MSG_ACK_FAMILY)					&& (snacPacket.getCommand() == SnacPacket.SRV_MSG_ACK_COMMAND))			{				ByteArrayInputStream stream = new ByteArrayInputStream(snacPacket.getData());				int messId1 = Util.getDWord(stream, true);				int messId2 = Util.getDWord(stream, true);				Util.getWord(stream, true);				if ((messId2 == 0x0001) && Options.getBoolean(Options.OPTION_DELIV_MES_INFO))				{					String uin = Util.getLenAndString(stream, 1);					MainThread.messageIsDelevered(uin, messId1);				}			}		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -