void LogXstatusChange(HANDLE hContact, char *szProto, int xstatusType, TCHAR *stzTitle, TCHAR *stzText) { XSTATUSCHANGE *xsc = NewXSC( hContact, szProto, xstatusType, NOTIFY_OPENING_ML, stzTitle[0] ? mir_tstrdup(stzTitle): NULL, stzText[0] ? mir_tstrdup(stzText) : NULL ); LogToMessageWindow(xsc, TRUE); FreeXSC(xsc); }
int ProcessExtraStatus(DBCONTACTWRITESETTING *cws, MCONTACT hContact) { XSTATUSCHANGE *xsc; STATUSMSGINFO smi = { 0 }; char *szProto = GetContactProto(hContact); smi.hContact = hContact; if (strstr(cws->szSetting, "/mood/") || strstr(cws->szSetting, "/activity/")) { // Jabber mood or activity changed if (!ProtoServiceExists(szProto, JS_PARSE_XMPP_URI)) return 0; char *szSetting; int type; if (strstr(cws->szSetting, "/mood/")) { type = TYPE_JABBER_MOOD; szSetting = "LastJabberMood"; } else { type = TYPE_JABBER_ACTIVITY; szSetting = "LastJabberActivity"; } if (strstr(cws->szSetting, "title")) { smi.compare = CompareStatusMsg(&smi, cws, szSetting); if (smi.compare == COMPARE_SAME) { replaceStrW(smi.newstatusmsg, nullptr); replaceStrW(smi.oldstatusmsg, nullptr); } if (cws->value.type == DBVT_DELETED) db_unset(hContact, "UserOnline", szSetting); else db_set(hContact, "UserOnline", szSetting, &cws->value); xsc = NewXSC(hContact, szProto, type, smi.compare, smi.newstatusmsg, nullptr); ExtraStatusChanged(xsc); } else if (strstr(cws->szSetting, "text")) { char dbSetting[128]; mir_snprintf(dbSetting, "%s%s", szSetting, "Msg"); smi.compare = CompareStatusMsg(&smi, cws, dbSetting); if (smi.compare == COMPARE_SAME) { replaceStrW(smi.newstatusmsg, nullptr); replaceStrW(smi.oldstatusmsg, nullptr); } if (cws->value.type == DBVT_DELETED) db_unset(hContact, "UserOnline", dbSetting); else db_set(hContact, "UserOnline", dbSetting, &cws->value); xsc = NewXSC(hContact, szProto, type, smi.compare * 4, nullptr, smi.newstatusmsg); ExtraStatusChanged(xsc); } return 1; } if (strstr(cws->szSetting, "XStatus")) { if (mir_strcmp(cws->szModule, szProto)) return 0; if (mir_strcmp(cws->szSetting, "XStatusName") == 0) { smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusName"); if (smi.compare == COMPARE_SAME) { replaceStrW(smi.newstatusmsg, nullptr); replaceStrW(smi.oldstatusmsg, nullptr); } if (cws->value.type == DBVT_DELETED) db_unset(hContact, "UserOnline", "LastXStatusName"); else db_set(hContact, "UserOnline", "LastXStatusName", &cws->value); xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare, smi.newstatusmsg, nullptr); ExtraStatusChanged(xsc); } else if (!mir_strcmp(cws->szSetting, "XStatusMsg")) { smi.compare = CompareStatusMsg(&smi, cws, "LastXStatusMsg"); if (smi.compare == COMPARE_SAME) { replaceStrW(smi.newstatusmsg, nullptr); replaceStrW(smi.oldstatusmsg, nullptr); } if (cws->value.type == DBVT_DELETED) db_unset(hContact, "UserOnline", "LastXStatusMsg"); else db_set(hContact, "UserOnline", "LastXStatusMsg", &cws->value); xsc = NewXSC(hContact, szProto, TYPE_ICQ_XSTATUS, smi.compare * 4, nullptr, smi.newstatusmsg); ExtraStatusChanged(xsc); } return 1; } return 0; }