本文整理汇总了C++中ptrA函数的典型用法代码示例。如果您正苦于以下问题:C++ ptrA函数的具体用法?C++ ptrA怎么用?C++ ptrA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ptrA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MapToTable
static void MapToTable(lua_State *L, const PROTOACCOUNT* pa)
{
lua_newtable(L);
lua_pushliteral(L, "ModuleName");
lua_pushstring(L, ptrA(mir_utf8encode(pa->szModuleName)));
lua_settable(L, -3);
lua_pushliteral(L, "AccountName");
lua_pushstring(L, ptrA(mir_utf8encodeT(pa->tszAccountName)));
lua_settable(L, -3);
lua_pushliteral(L, "ProtoName");
lua_pushstring(L, ptrA(mir_utf8encode(pa->szProtoName)));
lua_settable(L, -3);
lua_pushliteral(L, "IsEnabled");
lua_pushboolean(L, pa->bIsEnabled);
lua_settable(L, -3);
lua_pushliteral(L, "IsVisible");
lua_pushboolean(L, pa->bIsVisible);
lua_settable(L, -3);
lua_pushliteral(L, "IsVirtual");
lua_pushboolean(L, pa->bIsVirtual);
lua_settable(L, -3);
lua_pushliteral(L, "IsOldProto");
lua_pushboolean(L, pa->bOldProto);
lua_settable(L, -3);
}
示例2: SettingsChangedHookEventObjParam
static int SettingsChangedHookEventObjParam(void *obj, WPARAM wParam, LPARAM lParam, LPARAM param)
{
lua_State *L = (lua_State*)obj;
int ref = param;
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
lua_pushnumber(L, wParam);
DBCONTACTWRITESETTING *dbcws = (DBCONTACTWRITESETTING*)lParam;
lua_newtable(L);
lua_pushliteral(L, "Module");
lua_pushstring(L, dbcws->szModule);
lua_settable(L, -3);
lua_pushliteral(L, "Setting");
lua_pushstring(L, dbcws->szSetting);
lua_settable(L, -3);
lua_pushliteral(L, "Value");
switch (dbcws->value.type)
{
case DBVT_BYTE:
lua_pushinteger(L, dbcws->value.bVal);
break;
case DBVT_WORD:
lua_pushinteger(L, dbcws->value.wVal);
break;
case DBVT_DWORD:
lua_pushnumber(L, dbcws->value.dVal);
break;
case DBVT_ASCIIZ:
lua_pushstring(L, ptrA(mir_utf8encode(dbcws->value.pszVal)));
break;
case DBVT_UTF8:
lua_pushstring(L, dbcws->value.pszVal);
break;
case DBVT_WCHAR:
lua_pushstring(L, ptrA(mir_utf8encodeW(dbcws->value.pwszVal)));
break;
default:
lua_pushvalue(L, 4);
return 1;
}
lua_settable(L, -3);
if (lua_pcall(L, 2, 1, 0))
printf("%s\n", lua_tostring(L, -1));
int res = (int)lua_tointeger(L, 1);
return res;
}
示例3: FoldersGetCustomPathT
void CMLua::SetPaths()
{
TCHAR path[MAX_PATH];
FoldersGetCustomPathT(g_hScriptsFolder, path, _countof(path), VARST(MIRLUA_PATHT));
lua_getglobal(L, "package");
lua_pushfstring(L, "%s\\?.dll", ptrA(mir_utf8encodeT(path)));
lua_setfield(L, -2, "cpath");
lua_pushfstring(L, "%s\\?.lua", ptrA(mir_utf8encodeT(path)));
lua_setfield(L, -2, "path");
lua_pop(L, 1);
}
示例4: _T
char *TemplateHTMLBuilder::timestampToString(DWORD dwFlags, time_t check, int mode)
{
static char szResult[512];
TCHAR str[300];
DBTIMETOSTRINGT dbtts;
dbtts.cbDest = 70;
dbtts.szDest = str;
szResult[0] = '\0';
if (mode) { //time
dbtts.szFormat = (dwFlags & Options::LOG_SHOW_SECONDS) ? _T("s") : _T("t");
CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM)&dbtts);
}
else {//date
struct tm tm_now, tm_today;
time_t now = time(NULL);
time_t today;
tm_now = *localtime(&now);
tm_today = tm_now;
tm_today.tm_hour = tm_today.tm_min = tm_today.tm_sec = 0;
today = mktime(&tm_today);
if (dwFlags & Options::LOG_RELATIVE_DATE && check >= today)
_tcsncpy(str, TranslateT("Today"), SIZEOF(str));
else if(dwFlags & Options::LOG_RELATIVE_DATE && check > (today - 86400))
_tcsncpy(str, TranslateT("Yesterday"), SIZEOF(str));
else {
dbtts.szFormat = (dwFlags & Options::LOG_LONG_DATE) ? _T("D") : _T("d");
CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, check, (LPARAM) & dbtts);
}
}
lstrcpynA(szResult, ptrA(mir_utf8encodeT(str)), 500);
return szResult;
}
示例5: strcpy
void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url)
{
char* hippy = NULL;
if (!url)
url = ismail ? "http://mail.live.com?rru=inbox" : "http://profile.live.com";
const char *postdata = ismail ? postdataM : postdataS;
char passport[256];
if (db_get_static(NULL, m_szModuleName, "MsnPassportHost", passport, 256))
strcpy(passport, "https://login.live.com/");
char *p = strchr(passport, '/');
if (p && p[1] == '/') p = strchr(p + 2, '/');
if (p)
*p = 0;
CMStringA post = HotmailLogin(CMStringA().Format(postdata, (unsigned)time(NULL), ptrA(mir_urlEncode(url))));
if (!post.IsEmpty()) {
CMStringA hippy(passport);
hippy.AppendFormat("/ppsecure/sha1auth.srf?lc=%d&token=%s", itoa(langpref, passport, 10), ptrA(mir_urlEncode(post)));
debugLogA("Starting URL: '%s'", hippy);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)hippy.GetString());
}
}
示例6: _T
// Adds new contact
DWORD CMraProto::MraAddContact(MCONTACT hContact, DWORD dwContactFlag, DWORD dwGroupID, const CMStringA &szEmail, const CMStringW &wszCustomName, const CMStringA *szPhones, const CMString* wszAuthMessage)
{
if (szEmail.GetLength() <= 4 && !(dwContactFlag & CONTACT_FLAG_GROUP))
return 0;
dwContactFlag |= CONTACT_FLAG_UNICODE_NAME;
if (dwGroupID == -1)
dwGroupID = 0;
OutBuffer buf;
buf.SetUL(dwContactFlag);
buf.SetUL(dwGroupID);
buf.SetLPSLowerCase(szEmail);
buf.SetLPSW(wszCustomName);
buf.SetLPS((szPhones == NULL) ? "" : *szPhones);
// pack auth message
OutBuffer buf2;
buf2.SetUL(2);
buf2.SetLPSW(_T(""));//***deb possible nick here
buf2.SetLPSW((wszAuthMessage == NULL) ? _T("") : *wszAuthMessage);
buf.SetLPS(CMStringA(ptrA(mir_base64_encode(buf2.Data(), (int)buf2.Len()))));
buf.SetUL(0);
return MraSendQueueCMD(hSendQueueHandle, 0, hContact, ACKTYPE_ADDED, NULL, 0, MRIM_CS_ADD_CONTACT, buf.Data(), buf.Len());
}
示例7: ptrA
void FacebookProto::StickerAsSmiley(std::string sticker, const std::string &url, MCONTACT hContact)
{
std::string b64 = ptrA(mir_base64_encode((PBYTE)sticker.c_str(), (unsigned)sticker.length()));
b64 = utils::url::encode(b64);
std::tstring filename = GetAvatarFolder() + _T("\\stickers\\");
ptrT dir(mir_tstrdup(filename.c_str()));
filename += (TCHAR*)_A2T(b64.c_str());
filename += _T(".png");
// Check if we have this sticker already and download it it not
if (GetFileAttributes(filename.c_str()) == INVALID_FILE_ATTRIBUTES) {
HANDLE nlc = NULL;
facy.save_url(url, filename, nlc);
Netlib_CloseHandle(nlc);
}
SMADD_CONT cont;
cont.cbSize = sizeof(SMADD_CONT);
cont.hContact = hContact;
cont.type = 0;
cont.path = dir;
CallService(MS_SMILEYADD_LOADCONTACTSMILEYS, 0, (LPARAM)&cont);
}
示例8: CreateAuthString
void CreateAuthString(char *auth, MCONTACT hContact, HWND hwndDlg)
{
DBVARIANT dbv;
char *user = NULL, *pass = NULL;
TCHAR *tlogin = NULL, *tpass = NULL, buf[MAX_PATH] = {0};
if (hContact && db_get_b(hContact, MODULE, "UseAuth", 0)) {
if (!db_get_ts(hContact, MODULE, "Login", &dbv)) {
tlogin = mir_tstrdup(dbv.ptszVal);
db_free(&dbv);
}
tpass = db_get_tsa(hContact, MODULE, "Password");
}
else if (hwndDlg && IsDlgButtonChecked(hwndDlg, IDC_USEAUTH)) {
GetDlgItemText(hwndDlg, IDC_LOGIN, buf, SIZEOF(buf));
tlogin = mir_tstrdup(buf);
GetDlgItemText(hwndDlg, IDC_PASSWORD, buf, SIZEOF(buf));
tpass = mir_tstrdup(buf);
}
user = mir_t2a(tlogin);
pass = mir_t2a(tpass);
char str[MAX_PATH];
int len = mir_snprintf(str, SIZEOF(str), "%s:%s", user, pass);
mir_free(user);
mir_free(pass);
mir_free(tlogin);
mir_free(tpass);
mir_snprintf(auth, 250, "Basic %s", ptrA(mir_base64_encode((PBYTE)str, len)));
}
示例9: lenA
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
if (NULL == headA || NULL == headB) return NULL;
int lenA(1), lenB(1);
ListNode* ptrA(headA), *ptrB(headB);
while (NULL != ptrA->next) {
++lenA;
ptrA = ptrA->next;
}
while (NULL != ptrB->next) {
++lenB;
ptrB = ptrB->next;
}
if (ptrA != ptrB) return NULL;
ptrA = headA;
ptrB = headB;
int stepDiff(lenA - lenB);
if (0 < stepDiff) {
for (int i(0); i < stepDiff; ++i) ptrA = ptrA->next;
} else if (0 > stepDiff) {
for (int i(stepDiff); i < 0; ++i) ptrB = ptrB->next;
}
while (ptrA != ptrB) {
ptrA = ptrA->next;
ptrB = ptrB->next;
}
return ptrA;
}
示例10: dbei__index
static int dbei__index(lua_State *L)
{
DBEVENTINFO *dbei = (DBEVENTINFO*)luaL_checkudata(L, 1, MT_DBEVENTINFO);
const char *key = luaL_checkstring(L, 2);
if (mir_strcmpi(key, "Module") == 0)
lua_pushstring(L, ptrA(mir_utf8encode(dbei->szModule)));
else if (mir_strcmpi(key, "Timestamp") == 0)
lua_pushnumber(L, dbei->timestamp);
else if (mir_strcmpi(key, "Type") == 0)
lua_pushinteger(L, dbei->eventType);
else if (mir_strcmpi(key, "Flags") == 0)
lua_pushinteger(L, dbei->flags);
else if (mir_strcmpi(key, "Length") == 0)
lua_pushnumber(L, dbei->cbBlob);
else if (mir_strcmpi(key, "Blob") == 0)
{
lua_newtable(L);
for (DWORD i = 0; i < dbei->cbBlob; i++)
{
lua_pushinteger(L, i + 1);
lua_pushinteger(L, dbei->pBlob[i]);
lua_settable(L, -3);
}
}
else
lua_pushnil(L);
return 1;
}
示例11: mir_sntprintf
void CJabberProto::GetAvatarFileName(MCONTACT hContact, TCHAR* pszDest, size_t cbLen)
{
int tPathLen = mir_sntprintf(pszDest, cbLen, _T("%s\\%S"), VARST(_T("%miranda_avatarcache%")), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(pszDest);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(pszDest);
pszDest[ tPathLen++ ] = '\\';
const TCHAR* szFileType = ProtoGetAvatarExtension( getByte(hContact, "AvatarType", PA_FORMAT_PNG));
if (hContact != NULL) {
char str[ 256 ];
DBVARIANT dbv;
if (!db_get_utf(hContact, m_szModuleName, "jid", &dbv)) {
strncpy(str, dbv.pszVal, sizeof str);
str[ sizeof(str)-1 ] = 0;
db_free(&dbv);
}
else _i64toa((LONG_PTR)hContact, str, 10);
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S%s"), ptrA(JabberSha1(str)), szFileType);
}
else if (m_ThreadInfo != NULL) {
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%[email protected]%S avatar%s"),
m_ThreadInfo->username, m_ThreadInfo->server, szFileType);
}
else {
ptrA res1( getStringA("LoginName")), res2( getStringA("LoginServer"));
mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%[email protected]%S avatar%s"),
(res1) ? (LPSTR)res1 : "noname", (res2) ? (LPSTR)res2 : m_szModuleName, szFileType);
}
}
示例12: token
bool CSteamProto::Relogin()
{
ptrA token(getStringA("TokenSecret"));
if (mir_strlen(token) <= 0)
return false;
HttpRequest *request = new LogonRequest(token);
HttpResponse *response = request->Send(m_hNetlibUser);
bool success = false;
if (CheckResponse(response))
{
JSONROOT root(response->pData);
if (root != NULL) {
JSONNode *node = json_get(root, "error");
ptrT error(json_as_string(node));
if (!mir_tstrcmpi(error, _T("OK")))
{
node = json_get(root, "umqid");
setString("UMQID", ptrA(mir_u2a(ptrT(json_as_string(node)))));
node = json_get(root, "message");
setDword("MessageID", json_as_int(node));
success = true;
}
}
}
delete request;
delete response;
return success;
}
示例13: TlenGetAvatarFileName
void TlenGetAvatarFileName(TlenProtocol *proto, TLEN_LIST_ITEM *item, TCHAR* ptszDest, int cbLen)
{
int tPathLen = mir_sntprintf(ptszDest, cbLen, TEXT("%s\\%S"), VARST( TEXT("%miranda_avatarcache%")), proto->m_szModuleName);
if (_taccess(ptszDest, 0)) {
int ret = CreateDirectoryTreeT(ptszDest);
if (ret == 0)
proto->debugLog(_T("getAvatarFilename(): Created new directory for avatar cache: %s."), ptszDest);
else {
proto->debugLog(_T("getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s"), ptszDest, errno, strerror(errno));
TCHAR buffer[512];
mir_sntprintf(buffer, SIZEOF(buffer), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), ptszDest);
PUShowMessageT(buffer, SM_WARNING);
}
}
int format = PA_FORMAT_PNG;
ptszDest[ tPathLen++ ] = '\\';
if (item != NULL)
format = item->avatarFormat;
else if (proto->threadData != NULL)
format = proto->threadData->avatarFormat;
else
format = db_get_dw(NULL, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
const TCHAR *tszFileType = ProtoGetAvatarExtension(format);
if ( item != NULL )
mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S%s"), ptrA( TlenSha1(item->jid)), tszFileType);
else
mir_sntprintf(ptszDest + tPathLen, MAX_PATH - tPathLen, TEXT("%S_avatar%s"), proto->m_szModuleName, tszFileType);
}
示例14: mir_sntprintf
void CLuaScriptLoader::LoadScripts(const TCHAR *scriptDir, int iGroup)
{
TCHAR buf[4096];
mir_sntprintf(buf, _T("Loading scripts from %s"), scriptDir);
CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib, (LPARAM)buf);
RegisterScriptsFolder(ptrA(mir_utf8encodeT(scriptDir)));
TCHAR searchMask[MAX_PATH];
mir_sntprintf(searchMask, _T("%s\\%s"), scriptDir, _T("*.lua"));
TCHAR fullPath[MAX_PATH], path[MAX_PATH];
WIN32_FIND_DATA fd;
HANDLE hFind = FindFirstFile(searchMask, &fd);
if (hFind != INVALID_HANDLE_VALUE)
{
do
{
if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
mir_sntprintf(fullPath, _T("%s\\%s"), scriptDir, fd.cFileName);
PathToRelativeT(fullPath, path);
if (db_get_b(NULL, MODULE, _T2A(fd.cFileName), 1))
LoadScript(fullPath, iGroup);
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
}
示例15: MCONTACT
INT_PTR FacebookProto::OnMind(WPARAM wParam, LPARAM lParam)
{
if (!isOnline())
return 1;
MCONTACT hContact = MCONTACT(wParam);
wall_data *wall = new wall_data();
wall->user_id = ptrA(getStringA(hContact, FACEBOOK_KEY_ID));
wall->isPage = false;
if (wall->user_id == facy.self_.user_id) {
wall->title = _tcsdup(TranslateT("Own wall"));
} else
wall->title = getTStringA(hContact, FACEBOOK_KEY_NICK);
post_status_data *data = new post_status_data(this, wall);
if (wall->user_id == facy.self_.user_id) {
for (std::map<std::string, std::string>::iterator iter = facy.pages.begin(); iter != facy.pages.end(); ++iter) {
data->walls.push_back(new wall_data(iter->first, mir_utf8decodeT(iter->second.c_str()), true));
}
}
HWND hDlg = CreateDialogParam(g_hInstance, MAKEINTRESOURCE(IDD_MIND), (HWND)0, FBMindProc, reinterpret_cast<LPARAM>(data));
ShowWindow(hDlg, SW_SHOW);
return 0;
}