. :
:
public static ArrayList<String> parseTags = new ArrayList<String>();
public HashMap<String, String> mTags ;
:
mTags = new HashMap();
:
mTags = p.mTags;
PacketParserUtils.ParseMessage()
if (message.mTags != null) {
for (int i=0; i<Packet.parseTags.size(); i++) {
String tag = Packet.parseTags.get(i);
String value = parser.getAttributeValue("", tag);
message.mTags.put(tag, value);
}
}
In Message.toXML, before adding the ">", add:
if (mTags != null) {
Iterator<Entry<String, String>> it = mTags.entrySet().iterator();
while (it.hasNext()) {
Entry pairs = (Map.Entry)it.next();
String tag = (String) pairs.getKey();
String value = (String) pairs.getValue();
buf.append(" ").append(tag).append("=\"").append(value).append("\"");
}
}
Then, in the application, before installing the package handler, add all your own tags, for example:
Packet.parseTags.add(ROOMTYPE);
Packet.parseTags.add(ROOMNAME);
Packet.parseTags.add(CHATTYPE);
Also, before sending messages, add things such as:
message.mTags.put(ROOMTYPE, "Private");
message.mTags.put(ROOMNAME, UHInterface.liveSessionID);
message.mTags.put(MSGTYPE, "Photo");
source
share