[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    =?utf-8?q?=5Btelepathy-chat-handler=5D_/=3A_FIX_crash_when_creat?=
From:       Francesco Nwokeka <francesco.nwokeka () gmail ! com>
Date:       2011-06-24 18:47:49
Message-ID: 20110624184749.7D891A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 535258382980ea44b8c18323015188549293cf4f by Francesco Nwokeka.
Committed on 24/06/2011 at 20:49.
Pushed by nwokeka into branch 'master'.

FIX crash when creating group chats

Reviewed By: David Edmundson

M  +18   -10   app/chat-window.cpp     
M  +5    -0    lib/chat-widget.cpp     
M  +5    -2    lib/chat-widget.h     

http://commits.kde.org/telepathy-chat-handler/535258382980ea44b8c18323015188549293cf4f


diff --git a/app/chat-window.cpp b/app/chat-window.cpp
index 43c9d47..0e6094a 100644
--- a/app/chat-window.cpp
+++ b/app/chat-window.cpp
@@ -204,16 +204,24 @@ void ChatWindow::onCurrentIndexChanged(int index)
         onEnableSearchActions(true);
     }
 
-    // check which capabilities the contact and user supports
-    Tp::ContactCapabilities contactCapabilites = \
                currentChatTab->textChannel()->targetContact()->capabilities();
-    Tp::ContactCapabilities selfCapabilities = \
                currentChatTab->account()->connection()->selfContact()->capabilities();
                
-
-    setAudioCallEnabled(selfCapabilities.streamedMediaAudioCalls() && \
                contactCapabilites.streamedMediaAudioCalls());
-    setFileTransferEnabled(selfCapabilities.fileTransfers() && \
                contactCapabilites.fileTransfers());
-    setVideoCallEnabled(selfCapabilities.streamedMediaVideoCalls() && \
                contactCapabilites.streamedMediaVideoCalls());
-
-    /// TODO re-activate check when invitation to chat has been sorted out
-    setInviteToChatEnabled(false);
+    if (!currentChatTab->isGroupChat()) {
+        // check which capabilities the contact and user supports
+        Tp::ContactCapabilities contactCapabilites = \
currentChatTab->textChannel()->targetContact()->capabilities(); +        \
Tp::ContactCapabilities selfCapabilities = \
currentChatTab->account()->connection()->selfContact()->capabilities(); +
+        setAudioCallEnabled(selfCapabilities.streamedMediaAudioCalls() && \
contactCapabilites.streamedMediaAudioCalls()); +        \
setFileTransferEnabled(selfCapabilities.fileTransfers() && \
contactCapabilites.fileTransfers()); +        \
setVideoCallEnabled(selfCapabilities.streamedMediaVideoCalls() && \
contactCapabilites.streamedMediaVideoCalls()); +        /// TODO re-activate check \
when invitation to chat has been sorted out +        setInviteToChatEnabled(false);
+    } else {
+        // group chats don't have these functions
+        setAudioCallEnabled(false);
+        setFileTransferEnabled(false);
+        setVideoCallEnabled(false);
+        /// TODO re-activate check when invitation to chat has been sorted out
+        setInviteToChatEnabled(false);
+    }
 }
 
 void ChatWindow::onEnableSearchActions(bool enable)
diff --git a/lib/chat-widget.cpp b/lib/chat-widget.cpp
index b12162d..89e8c97 100644
--- a/lib/chat-widget.cpp
+++ b/lib/chat-widget.cpp
@@ -288,6 +288,11 @@ KIcon ChatWidget::icon() const
     }
 }
 
+bool ChatWidget::isGroupChat() const
+{
+    return d->isGroupChat;
+}
+
 ChatSearchBar* ChatWidget::chatSearchBar() const
 {
     return d->ui.searchBar;
diff --git a/lib/chat-widget.h b/lib/chat-widget.h
index 0255beb..06e98a1 100644
--- a/lib/chat-widget.h
+++ b/lib/chat-widget.h
@@ -48,11 +48,14 @@ public:
     /** Returns pointer to account used for chat */
     Tp::AccountPtr account() const;
 
+    /** Returns a pointer to the Chatwidget's search bar */
+    ChatSearchBar *chatSearchBar() const;
+
     /** Returns the icon of this chat window */
     KIcon icon() const;
 
-    /** Returns a pointer to the Chatwidget's search bar */
-    ChatSearchBar *chatSearchBar() const;
+    /** returns wether the chat is considered a group chat */
+    bool isGroupChat() const;
 
     /** invalidates the use of the chat.
      * @param enable flag to validate/invalidate chatWidget


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic