diff --git a/res/raw/linphonerc_factory b/res/raw/linphonerc_factory index 624d276fd..9368b2186 100644 --- a/res/raw/linphonerc_factory +++ b/res/raw/linphonerc_factory @@ -80,7 +80,7 @@ uuid=3ac65678-272f-47d9-8aff-19950c565687 friends_migration_done=1 user_certificates_path=/data/user/0/org.linphone/files file_transfer_server_url=https://www.linphone.org:444/lft.php -config-uri=https://85.233.205.218/xmlrpc?username=sylvain&password=cotcot&domain=sip.orangecyberdefense.com +config-uri=https://85.233.205.218/xmlrpc?username=margaux&password=cotcot&domain=sip.orangecyberdefense.com [audio_codec_0] mime=opus @@ -219,10 +219,10 @@ rate=90000 enabled=1 recv_fmtp=profile-level-id=42801F -[friend_0] +[friend_1] url="Sylvain Berfini" -[friend_1] +[friend_0] url="Margaux Clerc" [friend_2] diff --git a/src/org/linphone/ChatListFragment.java b/src/org/linphone/ChatListFragment.java index a5e5ec444..a1f56cdbf 100644 --- a/src/org/linphone/ChatListFragment.java +++ b/src/org/linphone/ChatListFragment.java @@ -365,7 +365,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence); avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL); - if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) { + if(contact != null && contact.isLinphoneFriend()) { avatarWithPresenceImage.setLinphoneContact(contact); LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); } diff --git a/src/org/linphone/ContactDetailsFragment.java b/src/org/linphone/ContactDetailsFragment.java index 01ca1005a..9507da9dc 100644 --- a/src/org/linphone/ContactDetailsFragment.java +++ b/src/org/linphone/ContactDetailsFragment.java @@ -119,7 +119,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence); avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_BIG); - if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) { + if(contact != null && contact.isLinphoneFriend()) { avatarWithPresenceImage.setLinphoneContact(contact); LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); } diff --git a/src/org/linphone/ContactsListFragment.java b/src/org/linphone/ContactsListFragment.java index fee3035a7..f3a0c08e2 100644 --- a/src/org/linphone/ContactsListFragment.java +++ b/src/org/linphone/ContactsListFragment.java @@ -414,6 +414,8 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O View view = null; LinphoneContact contact = (LinphoneContact) getItem(position); if (contact == null) return null; + Log.e("===>> getView - contact : isAndroidContact = "+contact.isAndroidContact()+" - is LinphoneFriend = "+contact.isLinphoneFriend()); + contact.refresh(); if (convertView != null) { view = convertView; @@ -443,11 +445,17 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O */ AvatarWithPresenceImage avatarWithPresenceImage = (AvatarWithPresenceImage) view.findViewById(R.id.avatar_with_presence); avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL); - if(contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) { + if(contact != null ) { avatarWithPresenceImage.setLinphoneContact(contact); - LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); + if (contact.isLinphoneFriend()) { + Log.e("===>> getView - contact != null"); + LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); + } + }else { + Log.e("===>> getView - everything == null"); + avatarWithPresenceImage.setLinphoneContact(contact); + LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); } - return view; } diff --git a/src/org/linphone/ContactsManager.java b/src/org/linphone/ContactsManager.java index aabd34607..83d58ddef 100644 --- a/src/org/linphone/ContactsManager.java +++ b/src/org/linphone/ContactsManager.java @@ -228,7 +228,7 @@ public class ContactsManager extends ContentObserver { } public List fetchContactsAsync() { - List contacts = new ArrayList(); + List contacts = new ArrayList(); if (mAccount != null && hasContactsAccess()) { Cursor c = Compatibility.getContactsCursor(contentResolver, null); diff --git a/src/org/linphone/HistoryDetailFragment.java b/src/org/linphone/HistoryDetailFragment.java index c6e700423..873cafa50 100644 --- a/src/org/linphone/HistoryDetailFragment.java +++ b/src/org/linphone/HistoryDetailFragment.java @@ -103,7 +103,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener { try { LinphoneAddress lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri); LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress); - if (contact != null && contact.isLinphoneFriend() && contact.getFriendPresenceModel() != null) { + if (contact != null && contact.isLinphoneFriend() ) { avatarWithPresenceImage.setLinphoneContact(contact); LinphoneActivity.instance().addPresenceUpdatedListener(avatarWithPresenceImage); } diff --git a/src/org/linphone/HistoryListFragment.java b/src/org/linphone/HistoryListFragment.java index f3f52420b..30cddc65b 100644 --- a/src/org/linphone/HistoryListFragment.java +++ b/src/org/linphone/HistoryListFragment.java @@ -450,7 +450,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On // } holder.avatarWithPresenceImage.setFormatAvatarImage(AvatarWithPresenceImage.AVATAR_SMALL); - if(c != null && c.isLinphoneFriend() && c.getFriendPresenceModel() != null) { + if(c != null && c.isLinphoneFriend() ) { holder.avatarWithPresenceImage.setLinphoneContact(c); LinphoneActivity.instance().addPresenceUpdatedListener(holder.avatarWithPresenceImage); } diff --git a/src/org/linphone/LinphoneActivity.java b/src/org/linphone/LinphoneActivity.java index 8901287c5..940134588 100644 --- a/src/org/linphone/LinphoneActivity.java +++ b/src/org/linphone/LinphoneActivity.java @@ -148,8 +148,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } + listeners = new ArrayList(); //Obiane specifics - //HTTP to HTTPS migration + //HTTP to HTTPS migrationf if(LinphonePreferences.instance().getRemoteProvisioningUrl() != null) { if(LinphonePreferences.instance().getRemoteProvisioningUrl().startsWith("http://")) { LinphonePreferences.instance().setRemoteProvisioningUrl(LinphonePreferences.instance().getRemoteProvisioningUrl().replace("http://", "https://")); @@ -282,8 +283,9 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta @Override public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { + Log.e("===>> LinphoneActivity : notifyPresenceReceived 1 : "+lf.getName().toString()); for(AvatarWithPresenceImage listener : listeners){ - Log.e("===>> LinphoneActivity : notifyPresenceReceived : "+lf.getName().toString()); + Log.e("===>> LinphoneActivity : notifyPresenceReceived 2 : "+lf.getName().toString()); if(listener.isThisFriend(lf)){ listener.updatePresenceIcon(lc, lf); } diff --git a/src/org/linphone/LinphoneContact.java b/src/org/linphone/LinphoneContact.java index 44e351be4..447e99fc5 100644 --- a/src/org/linphone/LinphoneContact.java +++ b/src/org/linphone/LinphoneContact.java @@ -29,6 +29,7 @@ import org.linphone.core.LinphoneCoreException; import org.linphone.core.LinphoneCoreFactory; import org.linphone.core.LinphoneFriend; import org.linphone.core.LinphoneFriend.SubscribePolicy; +import org.linphone.core.PresenceActivityType; import org.linphone.core.PresenceModel; import org.linphone.mediastream.Log; @@ -417,6 +418,13 @@ public class LinphoneContact implements Serializable, Comparable> getFriendPresenceModel - friend != null : "+friend.getPresenceModel()); + return friend.getPresenceModel(); + } else return null; } diff --git a/src/org/linphone/LinphoneManager.java b/src/org/linphone/LinphoneManager.java index 635c86f06..2b81c0cf2 100644 --- a/src/org/linphone/LinphoneManager.java +++ b/src/org/linphone/LinphoneManager.java @@ -243,6 +243,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag boolean gsmIdle = tm.getCallState() == TelephonyManager.CALL_STATE_IDLE; setGsmIdle(gsmIdle); + instance.enableProxyPublish(true); return instance; } @@ -349,6 +350,16 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag return false; } + private void enableProxyPublish( boolean enabled) { + LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); + LinphoneProxyConfig[] proxyList = lc.getProxyConfigList(); + for (LinphoneProxyConfig proxyConfig : proxyList){ + proxyConfig.edit(); + proxyConfig.enablePublish(enabled); + proxyConfig.done(); + } + } + public void changeStatusToOnline() { LinphoneCore lc = getLcIfManagerNotDestroyedOrNull(); if (isInstanciated() && lc != null && isPresenceModelActivitySet() && lc.getPresenceModel().getActivity().getType() != PresenceActivityType.Online) { @@ -790,6 +801,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void doDestroy() { + enableProxyPublish(false); if (LinphoneService.isReady()) // indeed, no need to crash ChatStorage.getInstance().close(); @@ -809,6 +821,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag } public static synchronized void destroy() { + instance.enableProxyPublish(false); if (instance == null) return; getInstance().changeStatusToOffline(); sExited = true; @@ -853,7 +866,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag public void notifyPresenceReceived(LinphoneCore lc, LinphoneFriend lf) { // TODO: - Log.e("===>> notifyPresenceReceived : "+lf.getName()); + Log.e("===>> LinphoneMAnager - notifyPresenceReceived : "+lf.getName()); } @Override diff --git a/src/org/linphone/ui/AvatarWithPresenceImage.java b/src/org/linphone/ui/AvatarWithPresenceImage.java index fc28f539c..a299aa226 100644 --- a/src/org/linphone/ui/AvatarWithPresenceImage.java +++ b/src/org/linphone/ui/AvatarWithPresenceImage.java @@ -75,6 +75,8 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc public void setLinphoneContact(LinphoneContact mContact){ this.contact = mContact; + //this.contact.refresh(); + updatePresenceIcon(null, null); } public boolean isThisFriend(LinphoneFriend myFriend){ @@ -102,6 +104,10 @@ public class AvatarWithPresenceImage extends RelativeLayout implements onPresenc friendStatusSmall.setImageResource(R.drawable.presence_offline); friendStatusBig.setImageResource(R.drawable.presence_offline); } + } else if(contact.isLinphoneFriend()){ + Log.e("===>>> updateAvatarPresence friend infromation is null "); + friendStatusSmall.setImageResource(R.drawable.presence_offline); + friendStatusBig.setImageResource(R.drawable.presence_offline); } else{ Log.e("===>>> updateAvatarPresence friend is null "); friendStatusSmall.setImageResource(R.drawable.presence_unregistered); diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java index 744b83f73..b46d2b427 100644 --- a/src/org/linphone/ui/BubbleChat.java +++ b/src/org/linphone/ui/BubbleChat.java @@ -206,22 +206,20 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen TextView contact = (TextView) view.findViewById(R.id.contact_header); - - - contactPicture = (ImageView) view.findViewById(R.id.contact_picture); + //contactPicture = (ImageView) view.findViewById(R.id.contact_picture); String displayName = nativeMessage.getFrom().getUserName(); - final String sipUri = nativeMessage.getFrom().asStringUriOnly(); if(!nativeMessage.isOutgoing()) { if (c != null) { displayName = c.getFullName(); - LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri()); - } else { - contactPicture.setImageResource(R.drawable.avatar); + // LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri()); + //} else { + // contactPicture.setImageResource(R.drawable.avatar); } } contact.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName); + } public View getView() {