📄 contactinfo.java
字号:
/*
* LumaQQ - Java QQ Client
*
* Copyright (C) 2004 luma <stubma@163.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package edu.tsinghua.lumaqq.qq.beans;
import java.nio.ByteBuffer;
import edu.tsinghua.lumaqq.qq.QQ;
import edu.tsinghua.lumaqq.qq.Util;
/**
* 一个用户的详细信息,全部都是字符串形式,按照QQ请求用户信息应答包中的顺序排列,一共37项
*
* @author 马若劼
*/
public class ContactInfo {
/**
* 分割符(char)30.
*/
public static final String DIVIDER = Character.toString((char) 30);
// 1. QQ号
public int qqStr = 0;
// 2. 昵称
public int nick = 1;
// 3. 国家
public int country = 2;
// 4. 省
public int province = 3;
// 5. 邮政编码
public int zipcode = 4;
// 6. 地址
public int address = 5;
// 7. 电话
public int telephone = 6;
// 8. 年龄
public int age = 7;
// 9. 性别
public int gender = 8;
// 10. 姓名
public int name = 9;
// 11. Email
public int email = 10;
// 12. 寻呼机sn,(sn是什么玩意,我也不知道)
public int pagerSn = 11;
// 13. 寻呼机号
public int pagerNum = 12;
// 14. 寻呼机服务提供商
public int pagerSp = 13;
// 15. 寻呼机base num(也不清楚这是什么)
public int pagerBaseNum = 14;
// 16. 寻呼机类型
public int pagerType = 15;
// 17. 职业
public int occupation = 16;
// 18. 主页
public int homepage = 17;
// 19. 认证类型(应该是被人加自己为好友的时候的认证类型把)
public int authType = 18;
// 20. unknown 1
public int unknown1 = 19;
// 21. unknown 2
public int unknown2 = 20;
// 22. 头像,头像是用一个数代表的,比如27, 因为QQ目录下的头像是从1开始编号的,
// 但是这个头像的数字却是从0开始计数的。并且注意,QQ的目录下面每种头像都
// 有3个bmp,所以按数字这么一排,27应该是10-1.bmp
public int face = 21;
// 23. 手机号
public int mobile = 22;
// 24. 手机类型
public int mobileType = 23;
// 25. 介绍
public int intro = 24;
// 26. 城市
public int city = 25;
// 27. unknown 3
public int unknown3 = 26;
// 28. unknown 4
public int unknown4 = 27;
// 29. unknown 5
public int unknown5 = 28;
// 30. is_open_hp
public int openHp = 29;
// 31. is_open_contact(通讯方式是否对其他人可见)
public int openContact = 30;
// 32. 学校
public int college = 31;
// 33. 星座
public int horoscope = 32;
// 34. 生肖
public int zodiac = 33;
// 35. 血型
public int blood = 34;
// 36. QQ秀
public int qqShow = 35;
// 37. unknown 6,总是0x2D
public int unknown6 = 36;
public String[] infos;
/**
* 构造函数
*/
public ContactInfo() {
infos = new String[QQ.QQ_CONTACT_FIELDS];
for(int i = 0; i < QQ.QQ_CONTACT_FIELDS; i++)
infos[i] = "";
}
/**
* 构造函数
*/
public ContactInfo(ByteBuffer buf) {
byte[] b = buf.array();
String s = Util.getString(buf);;
infos = s.split(DIVIDER);
infos[nick] = Util.filterUnprintableCharacter(infos[nick]);
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if(!(obj instanceof ContactInfo)) return false;
ContactInfo info = (ContactInfo)obj;
return info.infos[qqStr].equals(infos[qqStr]) &&
info.infos[country].equals(infos[country]) &&
info.infos[province].equals(infos[province]) &&
info.infos[zipcode].equals(infos[zipcode]) &&
info.infos[address].equals(infos[address]) &&
info.infos[telephone].equals(infos[telephone]) &&
info.infos[age].equals(infos[age]) &&
info.infos[gender].equals(infos[gender]) &&
info.infos[name].equals(infos[name]) &&
info.infos[email].equals(infos[email]) &&
info.infos[occupation].equals(infos[occupation]) &&
info.infos[homepage].equals(infos[homepage]) &&
info.infos[authType].equals(infos[authType]) &&
info.infos[face].equals(infos[face]) &&
info.infos[mobile].equals(infos[mobile]) &&
info.infos[intro].equals(infos[intro]) &&
info.infos[city].equals(infos[city]) &&
info.infos[openHp].equals(infos[openHp]) &&
info.infos[openContact].equals(infos[openContact]) &&
info.infos[college].equals(infos[college]) &&
info.infos[horoscope].equals(infos[horoscope]) &&
info.infos[zodiac].equals(infos[zodiac]) &&
info.infos[blood].equals(infos[blood]);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -