summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp30
-rw-r--r--protocols/Gadu-Gadu/src/groupchat.cpp35
2 files changed, 27 insertions, 38 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 724b242aa1..421cfef1a7 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -829,7 +829,7 @@ retry:
UIN2IDT(e->event.msg.sender, id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
@@ -838,7 +838,7 @@ retry:
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Conference message to room %s & id %s.", this, chat, id);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(messageT);
}
}
@@ -893,7 +893,7 @@ retry:
UIN2IDT(getDword(GG_KEY_UIN, 0), id);
GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = id;
wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
@@ -908,7 +908,7 @@ retry:
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"mainthread() (%x): Sent conference message to room %s.", this, chat);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(messageT);
mir_free(nickT);
}
@@ -1272,25 +1272,20 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM)
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
// Terminate conference if contact is deleted
- DBVARIANT dbv;
- if ( isChatRoom(hContact) && !getWString(hContact, "ChatRoomID", &dbv) && gc_enabled)
+ ptrW wszRoomId(getWStringA(hContact, "ChatRoomID"));
+ if (isChatRoom(hContact) && wszRoomId != NULL && gc_enabled)
{
- GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- GGGC *chat = gc_lookup(dbv.ptszVal);
-
- debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, dbv.pszVal);
+ GGGC *chat = gc_lookup(wszRoomId);
+ debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, wszRoomId);
if (chat)
{
// Destroy chat entry
free(chat->recipients);
list_remove(&chats, chat, 1);
// Terminate chat window / shouldn't cascade entry is deleted
- Chat_Event(SESSION_OFFLINE, &gce);
- Chat_Event(SESSION_TERMINATE, &gce);
+ Chat_Control(m_szModuleName, wszRoomId, SESSION_OFFLINE);
+ Chat_Terminate(m_szModuleName, wszRoomId);
}
-
- db_free(&dbv);
return 0;
}
@@ -1353,13 +1348,10 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam)
static int cascade = 0;
if (!cascade && dbv.ptszVal)
{
- GCDEST gcd = { m_szModuleName, dbv.ptszVal, GC_EVENT_CHANGESESSIONAME };
- GCEVENT gce = { sizeof(gce), &gcd };
- gce.ptszText = ptszVal;
debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
// Mark cascading
/* FIXME */ cascade = 1;
- Chat_Event(0, &gce);
+ Chat_ChangeSessionName(m_szModuleName, dbv.ptszVal, ptszVal);
/* FIXME */ cascade = 0;
}
db_free(&dbv);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp
index 892fcaad0a..b26c271602 100644
--- a/protocols/Gadu-Gadu/src/groupchat.cpp
+++ b/protocols/Gadu-Gadu/src/groupchat.cpp
@@ -33,7 +33,7 @@ int GGPROTO::gc_init()
char service[64];
// Register Gadu-Gadu proto
- GCREGISTER gcr = { sizeof(gcr) };
+ GCREGISTER gcr = {};
gcr.ptszDispName = m_tszUserName;
gcr.pszModule = m_szModuleName;
Chat_Register(&gcr);
@@ -150,7 +150,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, gch->pDest->ptszID, GC_EVENT_MESSAGE };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.ptszUID = id;
gce.ptszText = gch->ptszText;
wchar_t* nickT;
@@ -170,7 +170,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam)
gce.bIsMe = 1;
gce.dwFlags = GCEF_ADDTOLOG;
debugLogW(L"gc_event(): Sending conference message to room %s, \"%s\".", gch->pDest->ptszID, gch->ptszText);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(nickT);
T2Utf pszText_utf8(gch->ptszText);
@@ -211,7 +211,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
uin_t uin;
DBVARIANT dbv;
GCDEST gcd = { m_szModuleName, 0, GC_EVENT_ADDGROUP };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
debugLogA("gc_getchat(): Count %d.", recipients_count);
if (!recipients) return NULL;
@@ -311,12 +311,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
mir_snwprintf(status, TranslateT("This is my own conference."));
}
- GCSESSION gcwindow = { sizeof(gcwindow) };
+ GCSESSION gcwindow = {};
gcwindow.iType = GCW_CHATROOM;
gcwindow.pszModule = m_szModuleName;
gcwindow.ptszName = sender ? senderName : TranslateT("Conference");
gcwindow.ptszID = chat->id;
- gcwindow.dwItemData = (UINT_PTR)chat;
+ gcwindow.pItemData = chat;
gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
@@ -340,7 +340,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
// Add normal group
gce.ptszStatus = TranslateT("Participants");
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
gcd.iType = GC_EVENT_JOIN;
// Add myself
@@ -358,7 +358,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gce.ptszNick = nickT;
gce.bIsMe = 1;
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
mir_free(nickT);
debugLogW(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
}
@@ -383,11 +383,11 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou
gce.bIsMe = 0;
gce.dwFlags = 0;
debugLogW(L"gc_getchat(): Added %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
}
- gcd.iType = GC_EVENT_CONTROL;
- Chat_Event(SESSION_INITDONE, &gce);
- Chat_Event(SESSION_ONLINE, &gce);
+
+ Chat_Control(m_szModuleName, chat->id, SESSION_INITDONE);
+ Chat_Control(m_szModuleName, chat->id, SESSION_ONLINE);
debugLogW(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
@@ -479,11 +479,8 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa
if (count > i) i = count;
chat = gg->gc_getchat(0, participants, count);
if (chat)
- {
- GCDEST gcd = { gg->m_szModuleName, chat, GC_EVENT_CONTROL };
- GCEVENT gce = { sizeof(gce), &gcd };
- Chat_Event(WINDOW_VISIBLE, &gce);
- }
+ Chat_Control(gg->m_szModuleName, chat, WINDOW_VISIBLE);
+
free(participants);
}
}
@@ -632,13 +629,13 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick)
UIN2IDT(uin, id);
GCDEST gcd = { m_szModuleName, chat->id, GC_EVENT_NICK };
- GCEVENT gce = { sizeof(gce), &gcd };
+ GCEVENT gce = { &gcd };
gce.pDest = &gcd;
gce.ptszUID = id;
gce.ptszText = ptszNick;
debugLogW(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id);
- Chat_Event(0, &gce);
+ Chat_Event(&gce);
break;
}