diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2013-04-15 08:46:42 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2013-04-15 08:46:42 +0000 |
commit | 3142979bb604231a556d0173f0b2b90903399455 (patch) | |
tree | 9397d08749ccaa39cdc5ee39944f36274a53b756 | |
parent | 051a635f6b0046f9c63a5f457b39573b366e636d (diff) |
fixed crash when you did not select any contact for group chat creating
git-svn-id: http://svn.miranda-ng.org/main/trunk@4455 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/Skype/src/skype_chat.cpp | 103 | ||||
-rw-r--r-- | protocols/Skype/src/skype_dialogs.cpp | 6 |
2 files changed, 57 insertions, 52 deletions
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index 6da1496e51..e46a52bc1b 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -160,63 +160,66 @@ char *CSkypeProto::StartChat(const char *cid, const SEStringList &invitedContact SEString data;
CConversation::Ref conversation;
- if (cid)
- {
- this->skype->GetConversationByIdentity(cid, conversation);
- conversation->GetJoinBlob(data);
- this->skype->GetConversationByBlob(data, conversation, false);
- conversation->Join();
-
- chatID = ::mir_strdup(cid);
- }
- else
- {
- this->skype->CreateConference(conversation);
- conversation->SetOption(CConversation::P_OPT_JOINING_ENABLED, true);
- conversation->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER);
- conversation->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1);
-
- conversation->GetPropIdentity(data);
- chatID = ::mir_strdup(data);
- }
-
- conversation->AddConsumers(invitedContacts);
+ if (invitedContacts.size()) {
+ if (cid)
+ {
+ this->skype->GetConversationByIdentity(cid, conversation);
+ conversation->GetJoinBlob(data);
+ this->skype->GetConversationByBlob(data, conversation, false);
+ conversation->Join();
- conversation->GetPropDisplayname(data);
- char *chatName;
- if (data.length())
- chatName = ::mir_utf8decodeA(data);
- else
- chatName = Translate("New conference");
+ chatID = ::mir_strdup(cid);
+ }
+ else
+ {
+ this->skype->CreateConference(conversation);
+ conversation->SetOption(CConversation::P_OPT_JOINING_ENABLED, true);
+ conversation->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER);
+ conversation->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1);
- GCSESSION gcw = {0};
- gcw.cbSize = sizeof(gcw);
- gcw.iType = GCW_CHATROOM;
- gcw.pszModule = this->m_szModuleName;
- gcw.pszName = chatName;
- gcw.pszID = chatID;
- ::CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+ conversation->GetPropIdentity(data);
+ chatID = ::mir_strdup(data);
+ }
- GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_ADDGROUP };
- gcd.pszID = chatID;
+ conversation->AddConsumers(invitedContacts);
- GCEVENT gce = {0};
- gce.cbSize = sizeof(GCEVENT);
- gce.pDest = &gcd;
- for (int i = 0; i < SIZEOF(CSkypeProto::Groups); i++)
- {
- gce.pszStatus = Translate(CSkypeProto::Groups[i]);
- CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
- }
+ conversation->GetPropDisplayname(data);
+ TCHAR *chatName;
+ if (data.length())
+ chatName = ::mir_utf8decodeT(data);
+ else
+ chatName = TranslateT("New conference");
+
+ GCSESSION gcw = {0};
+ gcw.cbSize = sizeof(gcw);
+ gcw.iType = GCW_CHATROOM;
+ gcw.pszModule = this->m_szModuleName;
+ gcw.ptszName = chatName;
+ gcw.pszID = chatID;
+ ::CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM)&gcw);
+
+ GCDEST gcd = { m_szModuleName, { NULL }, GC_EVENT_ADDGROUP };
+ gcd.pszID = chatID;
+
+ GCEVENT gce = {0};
+ gce.cbSize = sizeof(GCEVENT);
+ gce.pDest = &gcd;
+ for (int i = 0; i < SIZEOF(CSkypeProto::Groups); i++)
+ {
+ gce.pszStatus = Translate(CSkypeProto::Groups[i]);
+ CallServiceSync(MS_GC_EVENT, NULL, (LPARAM)&gce);
+ }
- gcd.iType = GC_EVENT_CONTROL;
- ::CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ gcd.iType = GC_EVENT_CONTROL;
+ ::CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
+ ::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ ::CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
- ::mir_free(chatName);
+ ::mir_free(chatName);
- return chatID;
+ return chatID;
+ } else
+ return NULL;
}
void CSkypeProto::JoinToChat(const char *cid, bool showWindow)
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp index f6b6740ff7..2327d2e4ce 100644 --- a/protocols/Skype/src/skype_dialogs.cpp +++ b/protocols/Skype/src/skype_dialogs.cpp @@ -681,9 +681,11 @@ INT_PTR CALLBACK CSkypeProto::InviteToChatProc(HWND hwndDlg, UINT msg, WPARAM wP status);
}
}
+ if (chatID)
+ EndDialog(hwndDlg, IDOK);
+ else
+ param->ppro->ShowNotification(TranslateT("You did not select any contact"));
}
-
- EndDialog(hwndDlg, IDOK);
break;
case IDCANCEL:
|