I can get notified when someone adds me using the "contactAddedMe" method of my MsnAdapter. However, I seem to have an issue. This method only gets called when people try to add me and I'm *online*. How do I know if someone tried to add me while I was offline? Is there any way to get notified of this?
Also, I still have no clue how to set my display picture. Can anyone provide hints?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And when i look at all the different contactlists, the contact doesn't appear in even one of them. I'm using MSNP15. (i looked through all 5 of them)
When i was looking at the code i noticed that 2 soap request are being done. These new contact only appear in the answer to the first request, their not in the answer to the second soap request. And only contacts who are in the second soap request get added to the contactlist as a contact.
These contacts are added to a memberRole (net.sf.jml.protocol.soap.ContacList line 832), but i think that after this they are never retrieved and added to the contactlist.
I don't know if there is a solution to this?
I tried making it myself, but when i add this contact to the list, it couldn't be used for anything, i think this is beacause i'm missing the contactId.
I hope someone can help me, or point me in the right direction.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-08-10
Hello
My solution :
1) new class : MsnContactPending.java
package net.sf.jml;
/**
* @return pending list
*/
public HashMap<String,MsnContactPending> getPendingList();
3) in AbstractMessenger.java :
private HashMap<String,MsnContactPending> pendingList = new HashMap<String,MsnContactPending>(0);
public HashMap<String,MsnContactPending> getPendingList(){
return pendingList;
}
4) in ContactList.java : processMembers :
replace :
List ms = XmlUtils.locateElements(m,"Member","xsi:type","PassportMember");
Iterator i = ms.iterator();
while (i.hasNext()){
Element mem = (Element)i.next();
Element mn = XmlUtils.findChild(mem,"PassportName");
String name = XmlUtils.getText(mn);
memberRole.addMember(name);
}
by :
if (role.equals("Pending")){
List ms = XmlUtils.locateElements(m,"Member","xsi:type","PassportMember");
Iterator i = ms.iterator();
while (i.hasNext()){
Element mem = (Element)i.next();
Nice -- jessou would you mind submitting an issue in the issue tracker that includes this patch? (considering the nature of the patch, probably just include the .java file)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Can you send all modified files to me?
I got compilation error.
I will send my email address to you soon.
thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-08-10
correction :
for messenger only, we must write :
if (role.equals("Pending") && XmlUtils.getText( (Element)XmlUtils.findChildrenByChain((Element)e1.getParentNode(),new String[] { "Info","Handle","Type" }).get(0)).equals("Messenger"))
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Probably the best thing to do is to create an issue about the patch and attach it. You can also email it to me directly via I figure we might as well use the issue tracker for one of it's intended purposes =) Awesome on the patch though! I look forward to applying it!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2009-08-21
I sent you a message yesterday. Did you receive it ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can get notified when someone adds me using the "contactAddedMe" method of my MsnAdapter. However, I seem to have an issue. This method only gets called when people try to add me and I'm *online*. How do I know if someone tried to add me while I was offline? Is there any way to get notified of this?
Also, I still have no clue how to set my display picture. Can anyone provide hints?
I've not checked that issue yet, but i guess you should check the lists and add ppl that you miss:
msnMessenger.getContactList().getContactsInList(MsnList.RL) or MsnList.PR and call a msnMessenger.addFriend for each of them.
Changing owner picture is very easy, just check this out : http://java-jml.sourceforge.net/examples/PrettyMessenger.java
MsnObject displayPicture = MsnObject.getInstance(getEmail(),
"./resource/UserTile/headset.png");
messenger.getOwner().setInitDisplayPicture(displayPicture);
I'm having the same problem as nyx2095.
And when i look at all the different contactlists, the contact doesn't appear in even one of them. I'm using MSNP15. (i looked through all 5 of them)
When i was looking at the code i noticed that 2 soap request are being done. These new contact only appear in the answer to the first request, their not in the answer to the second soap request. And only contacts who are in the second soap request get added to the contactlist as a contact.
These contacts are added to a memberRole (net.sf.jml.protocol.soap.ContacList line 832), but i think that after this they are never retrieved and added to the contactlist.
I don't know if there is a solution to this?
I tried making it myself, but when i add this contact to the list, it couldn't be used for anything, i think this is beacause i'm missing the contactId.
I hope someone can help me, or point me in the right direction.
Hello
My solution :
1) new class : MsnContactPending.java
package net.sf.jml;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Pending contact
*
* @author Jessou
*/
public class MsnContactPending{
private Email email;
private String displayName;
private Date joinedDate;
/**
* @param email
* @param displayName
* @param joinedDate
*/
public MsnContactPending(Email email,String displayName,Date joinedDate){
super();
this.email = email;
this.displayName = displayName;
this.joinedDate = joinedDate;
}
/**
* @return the email
*/
public Email getEmail(){
return email;
}
/**
* @return the displayName
*/
public String getDisplayName(){
return displayName;
}
/**
* @return the joinedDate
*/
public Date getJoinedDate(){
return joinedDate;
}
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss");
@Override
public String toString(){
return "email : " + email.getEmailAddress() + "- displayName : " + displayName + "- joinedDate : "
+ sdf.format(joinedDate);
}
}
2) in MsnMessenger.java
/**
* @return pending list
*/
public HashMap<String,MsnContactPending> getPendingList();
3) in AbstractMessenger.java :
private HashMap<String,MsnContactPending> pendingList = new HashMap<String,MsnContactPending>(0);
public HashMap<String,MsnContactPending> getPendingList(){
return pendingList;
}
4) in ContactList.java : processMembers :
replace :
List ms = XmlUtils.locateElements(m,"Member","xsi:type","PassportMember");
Iterator i = ms.iterator();
while (i.hasNext()){
Element mem = (Element)i.next();
Element mn = XmlUtils.findChild(mem,"PassportName");
String name = XmlUtils.getText(mn);
memberRole.addMember(name);
}
by :
if (role.equals("Pending")){
List ms = XmlUtils.locateElements(m,"Member","xsi:type","PassportMember");
Iterator i = ms.iterator();
while (i.hasNext()){
Element mem = (Element)i.next();
Element mn = XmlUtils.findChild(mem,"DisplayName");
String name = XmlUtils.getText(mn);
mn = XmlUtils.findChild(mem,"JoinedDate");
Date joinedDate = null;
try{
joinedDate = DatatypeFactory.newInstance().newXMLGregorianCalendar(XmlUtils.getText(mn))
.toGregorianCalendar().getTime();
}catch (DatatypeConfigurationException e){
e.printStackTrace();
}
mn = XmlUtils.findChild(mem,"PassportName");
String email = XmlUtils.getText(mn);
HashMap<String,MsnContactPending> pendingList = ((AbstractMessenger)session.getMessenger())
.getPendingList();
if (!pendingList.containsKey(email))
pendingList.put(email,new MsnContactPending(Email.parseStr(email),name,joinedDate));
}
}else{
List ms = XmlUtils.locateElements(m,"Member","xsi:type","PassportMember");
Iterator i = ms.iterator();
while (i.hasNext()){
Element mem = (Element)i.next();
Element mn = XmlUtils.findChild(mem,"PassportName");
String name = XmlUtils.getText(mn);
memberRole.addMember(name);
}
}
5)
//see
MsnContactPending[] pending= messenger.getPendingList().values().toArray(new MsnContactPending[] {});
System.out.println(Arrays.toString(pending));
//add
if (pending.length != 0) messenger.addFriend(nouveaux[0].getEmail(),null);
Nice -- jessou would you mind submitting an issue in the issue tracker that includes this patch? (considering the nature of the patch, probably just include the .java file)
To jessou:
Can you send all modified files to me?
I got compilation error.
thank you
To jessou:
Can you send all modified files to me?
I got compilation error.
I will send my email address to you soon.
thank you
correction :
for messenger only, we must write :
if (role.equals("Pending") && XmlUtils.getText( (Element)XmlUtils.findChildrenByChain((Element)e1.getParentNode(),new String[] { "Info","Handle","Type" }).get(0)).equals("Messenger"))
To jadestorm:
In fact, I have a patch for sending offline message in unicode, what should I do?
thank you
Probably the best thing to do is to create an issue about the patch and attach it. You can also email it to me directly via I figure we might as well use the issue tracker for one of it's intended purposes =) Awesome on the patch though! I look forward to applying it!
I sent you a message yesterday. Did you receive it ?
Gmail consider your email as junk mail.
Sorry to bother u again.