event.setField("msg","Hello world");
return event;
*/
DatabaseAccess.connectToDB();
ArrayList<MsgPiece> list=DatabaseAccess.dbCheckNewIM();
MsgPiece msgT;
if(list.size()==0){
//DatabaseAccess.endConnectionToDB();
return null;
}else{
Event event =Event.createDataEvent("/chat");
for(int i=0,len=list.size();i<len;i++){
msgT=list.get(i);
event.setField("M"+i+"IDF",msgT.getpFrom());
event.setField("M"+i+"MSG",msgT.getContent());
event.setField("M"+i+"Time",msgT.getsTime().toString());
event.setField("M"+i+"To", msgT.getpTo());
event.setField("M"+i+"From", efrei.ngo.util.DatabaseAccess.dbGetNameViaID(msgT.getpFrom()));
}
//DatabaseAccess.endConnectionToDB();
return event;
}
}