Fixed potential crash if RelationInfo should not exist, which I saw
once while a decline was in progress), started some minor refactoring.
This commit is contained in:
parent
ce12ebe9ce
commit
e9367dd1c9
@ -278,6 +278,24 @@ void UserInfoDialog::declineFriendRequest()
|
|||||||
|
|
||||||
} // declineFriendRequest
|
} // declineFriendRequest
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/** Removes an existing friend.
|
||||||
|
*/
|
||||||
|
void UserInfoDialog::removeExistingFriend()
|
||||||
|
{
|
||||||
|
CurrentUser::get()->requestRemoveFriend(m_profile->getID());
|
||||||
|
|
||||||
|
} // removeExistingFriend
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
/** Removes a pending friend request.
|
||||||
|
*/
|
||||||
|
void UserInfoDialog::removePendingFriend()
|
||||||
|
{
|
||||||
|
CurrentUser::get()->requestCancelFriend(m_profile->getID());
|
||||||
|
|
||||||
|
} // removePendingFriend
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
GUIEngine::EventPropagation UserInfoDialog::processEvent(const std::string& eventSource)
|
GUIEngine::EventPropagation UserInfoDialog::processEvent(const std::string& eventSource)
|
||||||
{
|
{
|
||||||
@ -304,10 +322,12 @@ GUIEngine::EventPropagation UserInfoDialog::processEvent(const std::string& even
|
|||||||
}
|
}
|
||||||
else if(selection == m_remove_widget->m_properties[PROP_ID])
|
else if(selection == m_remove_widget->m_properties[PROP_ID])
|
||||||
{
|
{
|
||||||
if(m_profile->getRelationInfo()->isPending())
|
if (m_profile->getRelationInfo() &&
|
||||||
CurrentUser::get()->requestCancelFriend(m_profile->getID());
|
m_profile->getRelationInfo()->isPending() )
|
||||||
|
removePendingFriend();
|
||||||
else
|
else
|
||||||
CurrentUser::get()->requestRemoveFriend(m_profile->getID());
|
removeExistingFriend();
|
||||||
|
|
||||||
m_processing = true;
|
m_processing = true;
|
||||||
m_options_widget->setDeactivated();
|
m_options_widget->setDeactivated();
|
||||||
return GUIEngine::EVENT_BLOCK;
|
return GUIEngine::EVENT_BLOCK;
|
||||||
|
@ -63,6 +63,8 @@ private:
|
|||||||
void sendFriendRequest();
|
void sendFriendRequest();
|
||||||
void acceptFriendRequest();
|
void acceptFriendRequest();
|
||||||
void declineFriendRequest();
|
void declineFriendRequest();
|
||||||
|
void removeExistingFriend();
|
||||||
|
void removePendingFriend();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UserInfoDialog(uint32_t showing_id, const core::stringw info = "", bool error = false, bool from_queue = false);
|
UserInfoDialog(uint32_t showing_id, const core::stringw info = "", bool error = false, bool from_queue = false);
|
||||||
|
Loading…
Reference in New Issue
Block a user