?? messtype.java
字號:
//信息格式
package myQQ;
import java.io.*;
import java.util.*;
class MessType implements Serializable
{
String Sendid; //發送方號碼
String Sendpw; //發送方密碼
String Pro; //省
String City;//市
String SendName;//發送方昵稱
String SendPw;//發送密碼
String SendSex;//發送性別
int SendAge;//年齡
String SendHead; //頭像
String Readid; //接受方號碼
String Content; //發送內容
String Scene; //發送場景
String Results; //返回結果
Vector Friend; //好友列表
Vector RegPro; //省集合
Vector RegCity; //市集合
int State = 0; //狀態
/*
* 0--上線 2--隱身 3--離開 -1--下線
* 20--返回上線信息
* 10--發送消息 11--發送場景
* 4---注冊
* 41----省信息 42----市信息
*/
boolean HaseSend=false; //是否發送
Calendar SendTime; //發送時間
MessType(String Sendid, String SendName,String SendPw,
int SendAge,String SendSex,String Pro,String City,String Head)
{
//注冊信息
this.Sendid = Sendid;
this.SendName = SendName;
this.Sendpw = SendPw;
this.SendAge = SendAge;
this.SendSex = SendSex;
this.Pro = Pro;
this.City = City;
this.SendHead = Head;
this.State = 4;
}
MessType(String sid,String rid,String text,Calendar time,int state)
{ //用于發送信息的構造函數
this.Sendid = sid;
this.Readid = rid;
this.SendTime = time;
this.State = state;
if(State==10)
this.Content = text;
if(State==11)
this.Scene = text;
}
MessType(String sid,Calendar time,int state)
{ //用于狀態更改的構造函數
this.Sendid = sid;
this.SendTime = time;
this.State = state;
}
MessType(String id,String pw,int state)
{ //登錄信息
this.Sendid = id;
this.Sendpw = pw;
this.State = state;
}
MessType(String x,int state)
{ //返回結果+請求省市信息
this.State = state;
switch (this.State) {
case 0:
this.Results = x; break;
case 20:
this.Results = x; break;
case 41:
this.Sendid = x; break;
case 42:
this.Sendid = x; break;
case 4:
this.Sendid = x; break;
}
}
MessType(Vector v,int state)
{ //返回好友列表+返回省市
this.State = state;
switch (this.State) {
case 0: this.Friend = v; break;
case 41: this.RegPro = v; break;
case 42: this.RegCity = v; break;
}
}
public void setHaseSend(boolean hs)
{ //更改是否發送的狀態
this.HaseSend = hs;
}
public String getChatInfo()
{ //獲得聊天信息的基本內容--用于服務器
String stime = SendTime.toString();
String Info = "由"+Sendid+"發送給"+Readid+"\t時間:"+stime+"\n內容為:";
if(State==10)
Info += Content;
if(State==11)
Info += Scene;
return Info;
}
public String getStateInfo()
{ //獲得狀態信息的基本內容--用于服務器
String Info = Sendid;
String[] s = {"上線了!","隱身了!","離開了!","下線了!"};
switch (State) {
case 0: Info += s[0]+"\n"; break;
case 2: Info += s[1]+"\n"; break;
case 3: Info += s[2]+"\n"; break;
case -1: Info += s[3]+"\n"; break;
}
/*if(HaseSend)
Info += "已發送\n";
else
Info += "未發送\n";*/
return Info;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -