diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-16 19:43:24 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-16 19:43:24 +0000 |
commit | 0c41e6c4566fdb2d99b8a6ca1fb48859fd4a0e34 (patch) | |
tree | 700937499ee66952d1ca5b92928fc9ec3b034447 /protocols/Gadu-Gadu/src | |
parent | 7a7a6637021d78ad995f3e21e9743fae69bd2562 (diff) |
- chats services replaces with functions;
- chat calls switched from CallServiceSync to direct calls everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@17305 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 10 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 44 |
2 files changed, 25 insertions, 29 deletions
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index ffce72b6b5..724b242aa1 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(messageT);
mir_free(nickT);
}
@@ -1286,8 +1286,8 @@ int GGPROTO::contactdeleted(WPARAM hContact, LPARAM) free(chat->recipients);
list_remove(&chats, chat, 1);
// Terminate chat window / shouldn't cascade entry is deleted
- CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, (LPARAM)&gce);
+ Chat_Event(SESSION_OFFLINE, &gce);
+ Chat_Event(SESSION_TERMINATE, &gce);
}
db_free(&dbv);
@@ -1359,7 +1359,7 @@ int GGPROTO::dbsettingchanged(WPARAM hContact, LPARAM lParam) debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
// Mark cascading
/* FIXME */ cascade = 1;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
/* FIXME */ cascade = 0;
}
db_free(&dbv);
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 65db400791..892fcaad0a 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -30,24 +30,20 @@ //
int GGPROTO::gc_init()
{
- if (ServiceExists(MS_GC_REGISTER)) {
- char service[64];
+ char service[64];
- // Register Gadu-Gadu proto
- GCREGISTER gcr = { sizeof(gcr) };
- gcr.ptszDispName = m_tszUserName;
- gcr.pszModule = m_szModuleName;
- CallServiceSync(MS_GC_REGISTER, 0, (LPARAM)&gcr);
+ // Register Gadu-Gadu proto
+ GCREGISTER gcr = { sizeof(gcr) };
+ gcr.ptszDispName = m_tszUserName;
+ gcr.pszModule = m_szModuleName;
+ Chat_Register(&gcr);
- HookProtoEvent(ME_GC_EVENT, &GGPROTO::gc_event);
-
- gc_enabled = TRUE;
- // create & hook event
- mir_snprintf(service, GG_GC_GETCHAT, m_szModuleName);
- debugLogA("gc_init(): Registered with groupchat plugin.");
- }
- else debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
+ HookProtoEvent(ME_GC_EVENT, &GGPROTO::gc_event);
+ gc_enabled = TRUE;
+ // create & hook event
+ mir_snprintf(service, GG_GC_GETCHAT, m_szModuleName);
+ debugLogA("gc_init(): Registered with groupchat plugin.");
return 1;
}
@@ -174,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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(nickT);
T2Utf pszText_utf8(gch->ptszText);
@@ -329,7 +325,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gcwindow.ptszName = name;
// Create new room
- if (CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM) &gcwindow)) {
+ if (Chat_NewSession( &gcwindow)) {
debugLogW(L"gc_getchat(): Cannot create new chat window %s.", chat->id);
free(name);
free(chat);
@@ -344,7 +340,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou // Add normal group
gce.ptszStatus = TranslateT("Participants");
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
gcd.iType = GC_EVENT_JOIN;
// Add myself
@@ -362,7 +358,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gce.ptszNick = nickT;
gce.bIsMe = 1;
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
mir_free(nickT);
debugLogW(L"gc_getchat(): Myself %s: %s (%s) to the list...", gce.ptszUID, gce.ptszNick, gce.ptszStatus);
}
@@ -387,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);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
}
gcd.iType = GC_EVENT_CONTROL;
- CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gce);
- CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
+ Chat_Event(SESSION_INITDONE, &gce);
+ Chat_Event(SESSION_ONLINE, &gce);
debugLogW(L"gc_getchat(): Returning new chat window %s, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
@@ -486,7 +482,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa {
GCDEST gcd = { gg->m_szModuleName, chat, GC_EVENT_CONTROL };
GCEVENT gce = { sizeof(gce), &gcd };
- CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, (LPARAM)&gce);
+ Chat_Event(WINDOW_VISIBLE, &gce);
}
free(participants);
}
@@ -642,7 +638,7 @@ int GGPROTO::gc_changenick(MCONTACT hContact, wchar_t *ptszNick) gce.ptszText = ptszNick;
debugLogW(L"gc_changenick(): Found room %s with uin %d, sending nick change %s.", chat->id, uin, id);
- CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
+ Chat_Event(0, &gce);
break;
}
|