diff options
-rw-r--r-- | plugins/Clist_nicer/src/clui.cpp | 20 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/cluiframes.cpp | 4 | ||||
-rw-r--r-- | plugins/Clist_nicer/src/cluiservices.cpp | 3 | ||||
-rw-r--r-- | plugins/MyDetails/src/frame.cpp | 134 | ||||
-rw-r--r-- | plugins/Utils/mir_smileys.cpp | 6 | ||||
-rw-r--r-- | protocols/FacebookRM/src/json.cpp | 62 | ||||
-rw-r--r-- | protocols/FacebookRM/src/process.cpp | 21 |
7 files changed, 115 insertions, 135 deletions
diff --git a/plugins/Clist_nicer/src/clui.cpp b/plugins/Clist_nicer/src/clui.cpp index 59a506a4f1..752cc0c8c2 100644 --- a/plugins/Clist_nicer/src/clui.cpp +++ b/plugins/Clist_nicer/src/clui.cpp @@ -659,13 +659,14 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) HDC hdc = nmcsbcd->hdc; StatusItems_t *item = 0, *arrowItem = 0; UINT uItemID = ID_EXTBKSCROLLBACK; - RECT rcWindow; - POINT pt; - DWORD dfcFlags; HRGN rgn = 0; - GetWindowRect(pcli->hwndContactTree, &rcWindow); - pt.x = rcWindow.left; - pt.y = rcWindow.top; + + RECT rc; + GetWindowRect(pcli->hwndContactTree, &rc); + + POINT pt; + pt.x = rc.left; + pt.y = rc.top; ScreenToClient(pcli->hwndContactList, &pt); hdcScroll = hdc; BitBlt(hdcScroll, nmcsbcd->rect.left, nmcsbcd->rect.top, nmcsbcd->rect.right - nmcsbcd->rect.left, @@ -697,9 +698,8 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) DrawAlpha(hdcScroll, &nmcsbcd->rect, item->COLOR, alpha, item->COLOR2, item->COLOR2_TRANSPARENT, item->GRADIENT, item->CORNER, item->BORDERSTYLE, item->imageItem); } - dfcFlags = DFCS_FLAT | (nmcsbcd->uState == CDIS_DISABLED ? DFCS_INACTIVE : - (nmcsbcd->uState == CDIS_HOT ? DFCS_HOT : - (nmcsbcd->uState == CDIS_SELECTED ? DFCS_PUSHED : 0))); + DWORD dfcFlags = DFCS_FLAT | (nmcsbcd->uState == CDIS_DISABLED ? DFCS_INACTIVE : + (nmcsbcd->uState == CDIS_HOT ? DFCS_HOT : (nmcsbcd->uState == CDIS_SELECTED ? DFCS_PUSHED : 0))); if (nmcsbcd->uItem == HTSCROLL_UP) arrowItem = arStatusItems[ID_EXTBKSCROLLARROWUP - ID_STATUS_OFFLINE]; @@ -707,7 +707,7 @@ int CustomDrawScrollBars(NMCSBCUSTOMDRAW *nmcsbcd) arrowItem = arStatusItems[ID_EXTBKSCROLLARROWDOWN - ID_STATUS_OFFLINE]; if (arrowItem && !arrowItem->IGNORED) DrawAlpha(hdcScroll, &nmcsbcd->rect, arrowItem->COLOR, arrowItem->ALPHA, arrowItem->COLOR2, arrowItem->COLOR2_TRANSPARENT, - arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem); + arrowItem->GRADIENT, arrowItem->CORNER, arrowItem->BORDERSTYLE, arrowItem->imageItem); else if (arrowItem) DrawFrameControl(hdcScroll, &nmcsbcd->rect, DFC_SCROLL, (nmcsbcd->uItem == HTSCROLL_UP ? DFCS_SCROLLUP : DFCS_SCROLLDOWN) | dfcFlags); diff --git a/plugins/Clist_nicer/src/cluiframes.cpp b/plugins/Clist_nicer/src/cluiframes.cpp index ace31e1037..bbf7b4f8e0 100644 --- a/plugins/Clist_nicer/src/cluiframes.cpp +++ b/plugins/Clist_nicer/src/cluiframes.cpp @@ -1409,7 +1409,6 @@ static int UpdateTBToolTip(int framepos) int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BOOL hasTitleBar) { - HDC hdc; RECT rcWindow, rc; HWND hwndParent = GetParent(hwnd); LRESULT result = 0; @@ -1457,7 +1456,7 @@ int FrameNCPaint(HWND hwnd, WNDPROC oldWndProc, WPARAM wParam, LPARAM lParam, BO } if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_BORDER) { - hdc = GetWindowDC(hwnd); + HDC hdc = GetWindowDC(hwnd); HPEN hPenOld = reinterpret_cast<HPEN>(SelectObject(hdc, g_hPenCLUIFrames)); GetWindowRect(hwnd, &rcWindow); rc.left = rc.top = 0; @@ -2812,7 +2811,6 @@ LRESULT CALLBACK CLUIFrameContainerWndProc(HWND hwnd, UINT msg, WPARAM wParam, L CLUIFrameResizeFloatingFrame(framepos); - RECT rect; GetWindowRect(Frames[framepos].ContainerWnd, &rect); Frames[framepos].FloatingPos.x = rect.left; Frames[framepos].FloatingPos.y = rect.top; diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index cda2e1b583..e5e059f787 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -164,7 +164,8 @@ void CluiProtocolStatusChanged(int, const char*) // count down since built in ones tend to go at the end
char *szMaxProto = NULL;
- for (int i = 0, partCount = 0; i < protoCount; i++) {
+ partCount = 0;
+ for (int i = 0; i < protoCount; i++) {
int idx = pcli->pfnGetAccountIndexByPos(i);
if (idx == -1)
continue;
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index f54aa50a94..8bf2303ab8 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -372,15 +372,15 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP break;
case WM_SIZE:
- {
- HWND child = (HWND)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- RECT r;
- GetClientRect(hwnd, &r);
+ {
+ HWND child = (HWND)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ RECT r;
+ GetClientRect(hwnd, &r);
- SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
- InvalidateRect(child, NULL, TRUE);
- }
- return TRUE;
+ SetWindowPos(child, 0, r.left, r.top, r.right - r.left, r.bottom - r.top, SWP_NOZORDER | SWP_NOACTIVATE);
+ InvalidateRect(child, NULL, TRUE);
+ }
+ return TRUE;
case WM_CLOSE:
db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 0);
@@ -1441,7 +1441,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto }
else {
// Well, lets do it by hand
- static int statusModePf2List[] = { 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT,
+ static unsigned statusModePf2List[] = { 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT,
PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH };
menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
@@ -1523,10 +1523,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
Protocol *proto;
+ RECT r;
switch (msg) {
case WM_CREATE:
- {
data = new MyDetailsFrameData();
memset(data, 0, sizeof(MyDetailsFrameData));
SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
@@ -1541,23 +1541,21 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar SetCycleTime(hwnd);
SetStatusMessageRefreshTime(hwnd);
-
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = TME_HOVER | TME_LEAVE;
- tme.hwndTrack = hwnd;
- tme.dwHoverTime = HOVER_DEFAULT;
- TrackMouseEvent(&tme);
- }
- return TRUE;
+ {
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = TME_HOVER | TME_LEAVE;
+ tme.hwndTrack = hwnd;
+ tme.dwHoverTime = HOVER_DEFAULT;
+ TrackMouseEvent(&tme);
+ }
+ return TRUE;
case WM_PRINTCLIENT:
Draw(hwnd, (HDC)wParam);
return TRUE;
case WM_PAINT:
- {
- RECT r;
if (GetUpdateRect(hwnd, &r, FALSE)) {
PAINTSTRUCT ps;
@@ -1565,8 +1563,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar Draw(hwnd, hdc);
EndPaint(hwnd, &ps);
}
- }
- return TRUE;
+ return TRUE;
case WM_SIZE:
data->recalc_rectangles = true;
@@ -2048,14 +2045,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_NCMOUSELEAVE:
case WM_MOUSELEAVE:
- {
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = TME_HOVER;
- tme.hwndTrack = hwnd;
- tme.dwHoverTime = HOVER_DEFAULT;
- TrackMouseEvent(&tme);
- }
+ {
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = TME_HOVER;
+ tme.hwndTrack = hwnd;
+ tme.dwHoverTime = HOVER_DEFAULT;
+ TrackMouseEvent(&tme);
+ }
case WM_NCMOUSEMOVE:
MakeHover(hwnd, data->draw_img, &data->mouse_over_img, NULL, NULL);
MakeHover(hwnd, data->draw_nick, &data->mouse_over_nick, NULL, NULL);
@@ -2066,14 +2063,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case WM_MOUSEHOVER:
- {
- TRACKMOUSEEVENT tme;
- tme.cbSize = sizeof(TRACKMOUSEEVENT);
- tme.dwFlags = TME_LEAVE;
- tme.hwndTrack = hwnd;
- tme.dwHoverTime = HOVER_DEFAULT;
- TrackMouseEvent(&tme);
- }
+ {
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = TME_LEAVE;
+ tme.hwndTrack = hwnd;
+ tme.dwHoverTime = HOVER_DEFAULT;
+ TrackMouseEvent(&tme);
+ }
case WM_MOUSEMOVE:
proto = protocols->Get(data->protocol_number);
if (proto != NULL) {
@@ -2088,36 +2085,32 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case WM_NOTIFY:
- {
- LPNMHDR lpnmhdr = (LPNMHDR)lParam;
-
- switch (lpnmhdr->code) {
- case TTN_GETDISPINFO:
{
- MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
- proto = protocols->Get(data->protocol_number);
-
- LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lpnmhdr;
- SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
-
- if (lpnmhdr->hwndFrom == data->nick_tt_hwnd)
- lpttd->lpszText = proto->nickname;
- else if (lpnmhdr->hwndFrom == data->status_tt_hwnd)
- lpttd->lpszText = proto->status_name;
- else if (lpnmhdr->hwndFrom == data->away_msg_tt_hwnd)
- lpttd->lpszText = proto->status_message;
- else if (lpnmhdr->hwndFrom == data->listening_to_tt_hwnd)
- lpttd->lpszText = proto->listening_to;
- else if (lpnmhdr->hwndFrom == data->next_proto_tt_hwnd)
- lpttd->lpszText = TranslateT("Show next account");
- else if (lpnmhdr->hwndFrom == data->prev_proto_tt_hwnd)
- lpttd->lpszText = TranslateT("Show previous account");
-
- return 0;
- }
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
+ switch (lpnmhdr->code) {
+ case TTN_GETDISPINFO:
+ proto = protocols->Get(data->protocol_number);
+
+ LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lpnmhdr;
+ SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
+
+ if (lpnmhdr->hwndFrom == data->nick_tt_hwnd)
+ lpttd->lpszText = proto->nickname;
+ else if (lpnmhdr->hwndFrom == data->status_tt_hwnd)
+ lpttd->lpszText = proto->status_name;
+ else if (lpnmhdr->hwndFrom == data->away_msg_tt_hwnd)
+ lpttd->lpszText = proto->status_message;
+ else if (lpnmhdr->hwndFrom == data->listening_to_tt_hwnd)
+ lpttd->lpszText = proto->listening_to;
+ else if (lpnmhdr->hwndFrom == data->next_proto_tt_hwnd)
+ lpttd->lpszText = TranslateT("Show next account");
+ else if (lpnmhdr->hwndFrom == data->prev_proto_tt_hwnd)
+ lpttd->lpszText = TranslateT("Show previous account");
+
+ return 0;
+ }
}
- }
- break;
+ break;
case WM_DESTROY:
KillTimer(hwnd, ID_FRAME_TIMER);
@@ -2128,7 +2121,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
break;
- // Custom Messages //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Custom Messages //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
case MWM_REFRESH:
KillTimer(hwnd, ID_RECALC_TIMER);
SetTimer(hwnd, ID_RECALC_TIMER, RECALC_TIME, NULL);
@@ -2148,7 +2141,6 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar proto->GetNick();
RefreshFrame();
}
-
break;
case MWM_STATUS_CHANGED:
@@ -2160,7 +2152,6 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar RefreshFrame();
}
-
break;
case MWM_STATUS_MSG_CHANGED:
@@ -2400,8 +2391,7 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) || !mir_strcmp(cws->szSetting, "FirstName")
|| !mir_strcmp(cws->szSetting, "e-mail")
|| !mir_strcmp(cws->szSetting, "LastName")
- || !mir_strcmp(cws->szSetting, "JID"))
- {
+ || !mir_strcmp(cws->szSetting, "JID")) {
// Name changed
if (proto != NULL)
PostMessage(hwnd_frame, MWM_NICK_CHANGED, (WPARAM)proto->name, 0);
diff --git a/plugins/Utils/mir_smileys.cpp b/plugins/Utils/mir_smileys.cpp index 1c27bd67fc..6ecd7ce27b 100644 --- a/plugins/Utils/mir_smileys.cpp +++ b/plugins/Utils/mir_smileys.cpp @@ -236,10 +236,10 @@ SIZE GetTextSize(HDC hdcMem, const TCHAR *szText, SortedList *plText, UINT uText TextPiece *piece = (TextPiece *)plText->items[i];
if (piece->type == TEXT_PIECE_TYPE_TEXT) {
- RECT text_rc = { 0, 0, 0x7FFFFFFF, 0x7FFFFFFF };
+ RECT rc = { 0, 0, 0x7FFFFFFF, 0x7FFFFFFF };
- DrawText(hdcMem, &szText[piece->start_pos], piece->len, &text_rc, DT_CALCRECT | uTextFormat);
- text_size.cx = text_size.cx + text_rc.right - text_rc.left;
+ DrawText(hdcMem, &szText[piece->start_pos], piece->len, &rc, DT_CALCRECT | uTextFormat);
+ text_size.cx = text_size.cx + rc.right - rc.left;
}
else {
double factor;
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index ff11543ce7..3970cf44d8 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -401,7 +401,7 @@ void parseAttachments(FacebookProto *proto, std::string *message_text, const JSO } } -int facebook_json_parser::parse_messages(std::string *data, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications, bool inboxOnly) +int facebook_json_parser::parse_messages(std::string *pData, std::vector< facebook_message* >* messages, std::map< std::string, facebook_notification* >* notifications, bool inboxOnly) { // remove old received messages from map for (std::map<std::string, int>::iterator it = proto->facy.messages_ignore.begin(); it != proto->facy.messages_ignore.end();) { @@ -414,9 +414,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo } } - std::string jsonData = data->substr(9); - - JSONNode root = JSONNode::parse(jsonData.c_str()); + JSONNode root = JSONNode::parse(pData->substr(9).c_str()); if (!root) return EXIT_FAILURE; @@ -433,12 +431,11 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo if (t == "messaging") { // various messaging stuff (received and sent messages, getting seen info) - const JSONNode &type = (*it)["event"]; - if (!type) + const JSONNode &ev = (*it)["event"]; + if (!ev) continue; - std::string t = type.as_string(); - if (t == "read_receipt") { + if (ev.as_string() == "read_receipt") { // user read message const JSONNode &reader_ = (*it)["reader"]; const JSONNode &time_ = (*it)["time"]; @@ -461,12 +458,12 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo std::string tid = threadid.as_string(); - std::map<std::string, facebook_chatroom*>::iterator it = proto->facy.chat_rooms.find(tid); - if (it != proto->facy.chat_rooms.end()) { - facebook_chatroom *chatroom = it->second; + auto itRoom = proto->facy.chat_rooms.find(tid); + if (itRoom != proto->facy.chat_rooms.end()) { + facebook_chatroom *chatroom = itRoom->second; std::map<std::string, std::string> participants = chatroom->participants; - std::map<std::string, std::string>::const_iterator participant = participants.find(readerId); + auto participant = participants.find(readerId); if (participant == participants.end()) { // TODO: load name of this participant std::string name = readerId; @@ -667,12 +664,12 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo std::string tid = thread_.as_string(); std::string from_id = from_.as_string(); - std::map<std::string, facebook_chatroom*>::iterator it = proto->facy.chat_rooms.find(thread_.as_string()); - if (it != proto->facy.chat_rooms.end()) { - facebook_chatroom *chatroom = it->second; + auto itRoom = proto->facy.chat_rooms.find(thread_.as_string()); + if (itRoom != proto->facy.chat_rooms.end()) { + facebook_chatroom *chatroom = itRoom->second; std::map<std::string, std::string> participants = chatroom->participants; - std::map<std::string, std::string>::const_iterator participant = participants.find(from_id); + auto participant = participants.find(from_id); if (participant == participants.end()) { // TODO: load name of this participant std::string name = from_id; @@ -692,9 +689,7 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact, (LPARAM)&st); } - else { - CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact); - } + else CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hChatContact); // TODO: support proper MS_PROTO_CONTACTISTYPING service for chatrooms (when it will be implemented) } @@ -708,8 +703,8 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo if (!event_type || !event_data) continue; - std::string t = event_type.as_string(); - if (t == "visibility_update") { + std::string et = event_type.as_string(); + if (et == "visibility_update") { // change of chat status const JSONNode &visibility = event_data["visibility"]; @@ -761,10 +756,10 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo continue; std::string thread_id = thread_id_.as_string(); - std::string type = log_type_.as_string(); + std::string logType = log_type_.as_string(); std::string message_text = log_body_.as_string(); - if (type == "log:video-call") { + if (logType == "log:video-call") { std::string id = action_["other_user_fbid"].as_string(); std::string message_id = action_["message_id"].as_string(); @@ -804,13 +799,13 @@ int facebook_json_parser::parse_messages(std::string *data, std::vector< faceboo for (auto itAlerts = alerts.begin(); itAlerts != alerts.end(); ++itAlerts) { std::string id = (*itAlerts).as_string(); - std::map<std::string, facebook_notification*>::iterator it = notifications->find(id); - if (it != notifications->end()) { - if (it->second->hWndPopup != NULL) - PUDeletePopup(it->second->hWndPopup); // close popup + auto itAlert = notifications->find(id); + if (itAlert != notifications->end()) { + if (itAlert->second->hWndPopup != NULL) + PUDeletePopup(itAlert->second->hWndPopup); // close popup - delete it->second; - notifications->erase(it); + delete itAlert->second; + notifications->erase(itAlert); } } } @@ -971,8 +966,7 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< message->isIncoming = (author_id != proto->facy.self_.user_id); message->isUnread = isUnread; - std::map<std::string, facebook_chatroom*>::iterator iter = chatrooms->find(thread_id); - if (iter != chatrooms->end()) { + if (chatrooms->find(thread_id) != chatrooms->end()) { // this is chatroom message message->isChat = true; message->user_id = author_id; @@ -980,10 +974,10 @@ int facebook_json_parser::parse_thread_messages(std::string *data, std::vector< else { // this is standard message message->isChat = false; - std::map<std::string, std::string>::iterator iter = thread_ids.find(thread_id); - if (iter != thread_ids.end()) { + auto iter = thread_ids.find(thread_id); + if (iter != thread_ids.end()) message->user_id = iter->second; // TODO: Check if we have contact with this ID in friendlist and otherwise do something different? - } else { + else { delete message; continue; } diff --git a/protocols/FacebookRM/src/process.cpp b/protocols/FacebookRM/src/process.cpp index b3a700e230..97fd295899 100644 --- a/protocols/FacebookRM/src/process.cpp +++ b/protocols/FacebookRM/src/process.cpp @@ -331,12 +331,12 @@ void FacebookProto::ProcessUnreadMessages(void*) facy.handle_success("ProcessUnreadMessages"); } -void FacebookProto::ProcessUnreadMessage(void *data) +void FacebookProto::ProcessUnreadMessage(void *pParam) { - if (data == NULL) + if (pParam == NULL) return; - std::vector<std::string> *threads = (std::vector<std::string>*)data; + std::vector<std::string> *threads = (std::vector<std::string>*)pParam; if (isOffline()) { delete threads; @@ -440,21 +440,18 @@ void FacebookProto::ProcessUnreadMessage(void *data) delete threads; } -void FacebookProto::LoadLastMessages(void *p) +void FacebookProto::LoadLastMessages(void *pParam) { - if (p == NULL) + if (pParam == NULL) return; - if (isOffline()) { - delete (MCONTACT*)p; + MCONTACT hContact = *(MCONTACT*)pParam; + delete (MCONTACT*)pParam; + + if (isOffline()) return; - } facy.handle_entry("LoadLastMessages"); - - MCONTACT hContact = *(MCONTACT*)p; - delete (MCONTACT*)p; - if (!isOnline()) return; |