| 1 |
#include "NsmGetSetInfo.h" |
| 2 |
|
| 3 |
#include <array> |
| 4 |
|
| 5 |
#include "dummy.h" |
| 6 |
#include "NsmInfoUtility.h" |
| 7 |
|
| 8 |
namespace Regnessem |
| 9 |
{ |
| 10 |
namespace Common |
| 11 |
{ |
| 12 |
namespace NsmInfoUtility |
| 13 |
{ |
| 14 |
NsmInfoBase::NsmInfoBase(const TNsmPluginInitInfo &initInfo) |
| 15 |
: InitInfo(initInfo) |
| 16 |
{} |
| 17 |
|
| 18 |
HNsmService NsmInfoBase::GetService(const tstring &serviceName) const |
| 19 |
{ |
| 20 |
return InitInfo.GetService(t2c(serviceName).c_str()); |
| 21 |
} |
| 22 |
|
| 23 |
NsmInfoBase::~NsmInfoBase() |
| 24 |
{} |
| 25 |
|
| 26 |
//-- |
| 27 |
|
| 28 |
NsmGetInfo::NsmGetInfo(const TNsmPluginInitInfo &initInfo) |
| 29 |
:NsmInfoBase(initInfo) |
| 30 |
,HGetPluginInfo(GetService(NMS_SYSTEM_GETPLUGININFO)) |
| 31 |
,HGetConnectionInfo(GetService(NMS_SYSTEM_CONNECTION_GETINFO)) |
| 32 |
,HGetConnectionMemberInfo(GetService(NMS_SYSTEM_CONNECTION_MEMBERS_GETINFO)) |
| 33 |
,HGetConnectionGroupInfo(GetService(NMS_SYSTEM_CONNECTION_GROUPS_GETINFO)) |
| 34 |
,HGetSessionInfo(GetService(NMS_SYSTEM_SESSION_GETINFO)) |
| 35 |
,HGetSessionMemberInfo(GetService(NMS_SYSTEM_SESSION_MEMBERS_GETINFO)) |
| 36 |
,HGetFileSessionInfo(GetService(NMS_SYSTEM_FILESESSION_GETINFO)) |
| 37 |
{} |
| 38 |
|
| 39 |
LONG_PTR NsmGetInfo::GetConnectionInfo(HNsmConnection handle, const PNsmInfo nsmInfo, int infoKey) const |
| 40 |
{ |
| 41 |
TNsmConnectionInfo cInfo = {0}; |
| 42 |
cInfo.cbSize = sizeof(TNsmConnectionInfo); |
| 43 |
cInfo.nInfoKey = infoKey; |
| 44 |
cInfo.lpInfo = nsmInfo; |
| 45 |
|
| 46 |
return InitInfo.CallService(HGetConnectionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&cInfo)); |
| 47 |
} |
| 48 |
|
| 49 |
LONG_PTR NsmGetInfo::GetSessionInfo(HNsmSession handle, const PNsmInfo nsmInfo, int infoKey) const |
| 50 |
{ |
| 51 |
TNsmSessionInfo sInfo = {0}; |
| 52 |
sInfo.cbSize = sizeof(TNsmSessionInfo); |
| 53 |
sInfo.nInfoKey = infoKey; |
| 54 |
sInfo.lpInfo = nsmInfo; |
| 55 |
|
| 56 |
return InitInfo.CallService(HGetSessionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&sInfo)); |
| 57 |
} |
| 58 |
|
| 59 |
LONG_PTR NsmGetInfo::GetFileSessionInfo(HNsmFileSession handle, const PNsmInfo nsmInfo, int infoKey) const |
| 60 |
{ |
| 61 |
TNsmFileSessionInfo fInfo = {0}; |
| 62 |
fInfo.cbSize = sizeof(TNsmFileSessionInfo); |
| 63 |
fInfo.nInfoKey = infoKey; |
| 64 |
fInfo.lpInfo = nsmInfo; |
| 65 |
|
| 66 |
return InitInfo.CallService(HGetFileSessionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&fInfo)); |
| 67 |
} |
| 68 |
|
| 69 |
LONG_PTR NsmGetInfo::GetGroupInfo(HNsmConnection handle, const PNsmInfo nsmInfo, int groupId, int infoKey) const |
| 70 |
{ |
| 71 |
TNsmGroupInfo gInfo = {0}; |
| 72 |
gInfo.cbSize = sizeof(TNsmGroupInfo); |
| 73 |
gInfo.nGroupId = groupId; |
| 74 |
gInfo.nInfoKey = infoKey; |
| 75 |
gInfo.lpInfo = nsmInfo; |
| 76 |
|
| 77 |
return InitInfo.CallService(HGetConnectionGroupInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&gInfo)); |
| 78 |
} |
| 79 |
|
| 80 |
LONG_PTR NsmGetInfo::GetMemberInfo(HNsmService svc, void *const handle, const PNsmInfo nsmInfo, const std::string &account, int infoKey, int listKind) const |
| 81 |
{ |
| 82 |
TNsmMemberInfo mInfo = {0}; |
| 83 |
mInfo.cbSize = sizeof(TNsmMemberInfo); |
| 84 |
mInfo.nListKind = listKind; |
| 85 |
mInfo.lpAccount = account.c_str(); |
| 86 |
mInfo.nInfoKey = infoKey; |
| 87 |
mInfo.lpInfo = nsmInfo; |
| 88 |
|
| 89 |
return InitInfo.CallService(svc, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&mInfo)); |
| 90 |
} |
| 91 |
|
| 92 |
//--- |
| 93 |
|
| 94 |
std::string NsmGetInfo::GetPluginInfo(const std::string &moduleName, int infoKey) const |
| 95 |
{ |
| 96 |
std::array<char, BufferSize> buff = {}; |
| 97 |
|
| 98 |
TNsmPluginInfo pluginInfo = {}; |
| 99 |
pluginInfo.cbSize = sizeof(pluginInfo); |
| 100 |
pluginInfo.lpModuleName = moduleName.c_str(); |
| 101 |
pluginInfo.nInfoNo = infoKey; |
| 102 |
pluginInfo.lpBuffer = buff.data(); |
| 103 |
pluginInfo.nBufferSize = std::tuple_size<decltype(buff)>::value; |
| 104 |
|
| 105 |
InitInfo.CallService(HGetPluginInfo, reinterpret_cast<WPARAM>(&pluginInfo), 0); |
| 106 |
|
| 107 |
return buff.data(); |
| 108 |
} |
| 109 |
|
| 110 |
std::wstring NsmGetInfo::GetConnectionInfoStr(HNsmConnection handle, int infoKey) const |
| 111 |
{ |
| 112 |
wchar_t buff[BufferSize] = {0}; |
| 113 |
|
| 114 |
TNsmInfo nsmInfo = {0}; |
| 115 |
nsmInfo.lpBuffer = buff; |
| 116 |
nsmInfo.nBufferSize = sizeof(buff); |
| 117 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 118 |
|
| 119 |
GetConnectionInfo(handle,&nsmInfo,infoKey); |
| 120 |
|
| 121 |
return NsmInfoToStrW(&nsmInfo); |
| 122 |
} |
| 123 |
|
| 124 |
int NsmGetInfo::GetConnectionInfoInt(HNsmConnection handle,int infoKey) const |
| 125 |
{ |
| 126 |
int buff = 0; |
| 127 |
|
| 128 |
TNsmInfo nsmInfo = {0}; |
| 129 |
nsmInfo.lpBuffer = &buff; |
| 130 |
nsmInfo.nBufferSize = sizeof(buff); |
| 131 |
nsmInfo.nType = NMIT_INTEGER; |
| 132 |
|
| 133 |
GetConnectionInfo(handle,&nsmInfo,infoKey); |
| 134 |
|
| 135 |
return NsmInfoToInt(&nsmInfo); |
| 136 |
} |
| 137 |
|
| 138 |
bool NsmGetInfo::GetConnectionInfoBool(HNsmConnection handle,int infoKey) const |
| 139 |
{ |
| 140 |
unsigned char buff = 0; |
| 141 |
|
| 142 |
TNsmInfo nsmInfo = {0}; |
| 143 |
nsmInfo.lpBuffer = &buff; |
| 144 |
nsmInfo.nBufferSize = sizeof(buff); |
| 145 |
nsmInfo.nType = NMIT_BOOL; |
| 146 |
|
| 147 |
GetConnectionInfo(handle,&nsmInfo,infoKey); |
| 148 |
|
| 149 |
return NsmInfoToBool(&nsmInfo); |
| 150 |
} |
| 151 |
|
| 152 |
std::wstring NsmGetInfo::GetSessionInfoStr(HNsmSession handle, int infoKey) const |
| 153 |
{ |
| 154 |
wchar_t buff[BufferSize] = {0}; |
| 155 |
|
| 156 |
TNsmInfo nsmInfo = {0}; |
| 157 |
nsmInfo.lpBuffer = buff; |
| 158 |
nsmInfo.nBufferSize = sizeof(buff); |
| 159 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 160 |
|
| 161 |
GetSessionInfo(handle,&nsmInfo,infoKey); |
| 162 |
|
| 163 |
return NsmInfoToStrW(&nsmInfo); |
| 164 |
} |
| 165 |
|
| 166 |
int NsmGetInfo::GetSessionInfoInt(HNsmSession handle, int infoKey) const |
| 167 |
{ |
| 168 |
int buff = 0; |
| 169 |
|
| 170 |
TNsmInfo nsmInfo = {0}; |
| 171 |
nsmInfo.lpBuffer = &buff; |
| 172 |
nsmInfo.nBufferSize = sizeof(buff); |
| 173 |
nsmInfo.nType = NMIT_INTEGER; |
| 174 |
|
| 175 |
GetSessionInfo(handle,&nsmInfo,infoKey); |
| 176 |
|
| 177 |
return NsmInfoToInt(&nsmInfo); |
| 178 |
} |
| 179 |
|
| 180 |
std::wstring NsmGetInfo::GetFileSessionInfoStr(HNsmFileSession handle, int infoKey) const |
| 181 |
{ |
| 182 |
wchar_t buff[BufferSize] = {0}; |
| 183 |
|
| 184 |
TNsmInfo nsmInfo = {0}; |
| 185 |
nsmInfo.lpBuffer = buff; |
| 186 |
nsmInfo.nBufferSize = sizeof(buff); |
| 187 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 188 |
|
| 189 |
GetFileSessionInfo(handle,&nsmInfo,infoKey); |
| 190 |
|
| 191 |
return NsmInfoToStrW(&nsmInfo); |
| 192 |
} |
| 193 |
|
| 194 |
int NsmGetInfo::GetFileSessionInfoInt(HNsmFileSession handle, int infoKey) const |
| 195 |
{ |
| 196 |
int buff = 0; |
| 197 |
|
| 198 |
TNsmInfo nsmInfo = {0}; |
| 199 |
nsmInfo.lpBuffer = &buff; |
| 200 |
nsmInfo.nBufferSize = sizeof(buff); |
| 201 |
nsmInfo.nType = NMIT_INTEGER; |
| 202 |
|
| 203 |
GetFileSessionInfo(handle,&nsmInfo,infoKey); |
| 204 |
|
| 205 |
return NsmInfoToInt(&nsmInfo); |
| 206 |
} |
| 207 |
|
| 208 |
INT64 NsmGetInfo::GetFileSessionInfoInt64(HNsmFileSession handle, int infoKey) const |
| 209 |
{ |
| 210 |
INT64 buff = 0; |
| 211 |
|
| 212 |
TNsmInfo nsmInfo = {0}; |
| 213 |
nsmInfo.lpBuffer = &buff; |
| 214 |
nsmInfo.nBufferSize = sizeof(buff); |
| 215 |
nsmInfo.nType = NMIT_INT64; |
| 216 |
|
| 217 |
GetFileSessionInfo(handle,&nsmInfo,infoKey); |
| 218 |
|
| 219 |
return NsmInfoToInt64(&nsmInfo); |
| 220 |
} |
| 221 |
|
| 222 |
bool NsmGetInfo::GetFileSessionInfoBool(HNsmFileSession handle, int infoKey) const |
| 223 |
{ |
| 224 |
unsigned char buff = 0; |
| 225 |
|
| 226 |
TNsmInfo nsmInfo = {0}; |
| 227 |
nsmInfo.lpBuffer = &buff; |
| 228 |
nsmInfo.nBufferSize = sizeof(buff); |
| 229 |
nsmInfo.nType = NMIT_BOOL; |
| 230 |
|
| 231 |
GetFileSessionInfo(handle,&nsmInfo,infoKey); |
| 232 |
|
| 233 |
return NsmInfoToBool(&nsmInfo); |
| 234 |
} |
| 235 |
|
| 236 |
std::wstring NsmGetInfo::GetGroupInfoStr(HNsmConnection handle, int groupID, int infoKey) const |
| 237 |
{ |
| 238 |
wchar_t buff[BufferSize] = {0}; |
| 239 |
|
| 240 |
TNsmInfo nsmInfo = {0}; |
| 241 |
nsmInfo.lpBuffer = buff; |
| 242 |
nsmInfo.nBufferSize = sizeof(buff); |
| 243 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 244 |
|
| 245 |
GetGroupInfo(handle,&nsmInfo,groupID,infoKey); |
| 246 |
|
| 247 |
return NsmInfoToStrW(&nsmInfo); |
| 248 |
} |
| 249 |
|
| 250 |
int NsmGetInfo::GetGroupInfoInt(HNsmConnection handle, int groupID, int infoKey) const |
| 251 |
{ |
| 252 |
int buff = 0; |
| 253 |
|
| 254 |
TNsmInfo nsmInfo = {0}; |
| 255 |
nsmInfo.lpBuffer = &buff; |
| 256 |
nsmInfo.nBufferSize = sizeof(buff); |
| 257 |
nsmInfo.nType = NMIT_INTEGER; |
| 258 |
|
| 259 |
GetGroupInfo(handle,&nsmInfo,groupID,infoKey); |
| 260 |
|
| 261 |
return NsmInfoToInt(&nsmInfo); |
| 262 |
} |
| 263 |
|
| 264 |
bool NsmGetInfo::GetGroupInfoBool(HNsmConnection handle, int groupID, int infoKey) const |
| 265 |
{ |
| 266 |
unsigned char buff = 0; |
| 267 |
|
| 268 |
TNsmInfo nsmInfo = {0}; |
| 269 |
nsmInfo.lpBuffer = &buff; |
| 270 |
nsmInfo.nBufferSize = sizeof(buff); |
| 271 |
nsmInfo.nType = NMIT_BOOL; |
| 272 |
|
| 273 |
GetGroupInfo(handle,&nsmInfo,groupID,infoKey); |
| 274 |
|
| 275 |
return NsmInfoToBool(&nsmInfo); |
| 276 |
} |
| 277 |
|
| 278 |
std::wstring NsmGetInfo::GetMemberInfoStr(HNsmConnection handle, const std::string &account, int infoKey, int listKind) const |
| 279 |
{ |
| 280 |
wchar_t buff[BufferSize] = {0}; |
| 281 |
|
| 282 |
TNsmInfo nsmInfo = {0}; |
| 283 |
nsmInfo.lpBuffer = buff; |
| 284 |
nsmInfo.nBufferSize = sizeof(buff); |
| 285 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 286 |
|
| 287 |
GetMemberInfo(HGetConnectionMemberInfo,handle,&nsmInfo,account,infoKey,listKind); |
| 288 |
|
| 289 |
return NsmInfoToStrW(&nsmInfo); |
| 290 |
} |
| 291 |
|
| 292 |
int NsmGetInfo::GetMemberInfoInt(HNsmConnection handle, const std::string &account, int infoKey, int listKind) const |
| 293 |
{ |
| 294 |
int buff = 0; |
| 295 |
|
| 296 |
TNsmInfo nsmInfo = {0}; |
| 297 |
nsmInfo.lpBuffer = &buff; |
| 298 |
nsmInfo.nBufferSize = sizeof(buff); |
| 299 |
nsmInfo.nType = NMIT_INTEGER; |
| 300 |
|
| 301 |
GetMemberInfo(HGetConnectionMemberInfo,handle,&nsmInfo,account,infoKey,listKind); |
| 302 |
|
| 303 |
return NsmInfoToInt(&nsmInfo); |
| 304 |
} |
| 305 |
|
| 306 |
std::wstring NsmGetInfo::GetSessionMemberInfoStr(HNsmSession handle, const std::string &account, int infoKey) const |
| 307 |
{ |
| 308 |
wchar_t buff[BufferSize] = {0}; |
| 309 |
|
| 310 |
TNsmInfo nsmInfo = {0}; |
| 311 |
nsmInfo.lpBuffer = buff; |
| 312 |
nsmInfo.nBufferSize = sizeof(buff); |
| 313 |
nsmInfo.nType = NMIT_WIDESTRING; |
| 314 |
|
| 315 |
GetMemberInfo(HGetSessionMemberInfo,handle,&nsmInfo,account,infoKey); |
| 316 |
|
| 317 |
return NsmInfoToStrW(&nsmInfo); |
| 318 |
} |
| 319 |
|
| 320 |
int NsmGetInfo::GetSessionMemberInfoInt(HNsmSession handle, const std::string &account, int infoKey) const |
| 321 |
{ |
| 322 |
int buff = 0; |
| 323 |
|
| 324 |
TNsmInfo nsmInfo = {0}; |
| 325 |
nsmInfo.lpBuffer = &buff; |
| 326 |
nsmInfo.nBufferSize = sizeof(buff); |
| 327 |
nsmInfo.nType = NMIT_INTEGER; |
| 328 |
|
| 329 |
GetMemberInfo(HGetSessionMemberInfo,handle,&nsmInfo,account,infoKey); |
| 330 |
|
| 331 |
return NsmInfoToInt(&nsmInfo); |
| 332 |
} |
| 333 |
|
| 334 |
bool NsmGetInfo::GetSessionMemberInfoBool(HNsmSession handle, const std::string &account, int infoKey) const |
| 335 |
{ |
| 336 |
unsigned char buff = 0; |
| 337 |
|
| 338 |
TNsmInfo nsmInfo = {0}; |
| 339 |
nsmInfo.lpBuffer = &buff; |
| 340 |
nsmInfo.nBufferSize = sizeof(buff); |
| 341 |
nsmInfo.nType = NMIT_BOOL; |
| 342 |
|
| 343 |
GetMemberInfo(HGetSessionMemberInfo,handle,&nsmInfo,account,infoKey); |
| 344 |
|
| 345 |
return NsmInfoToBool(&nsmInfo); |
| 346 |
} |
| 347 |
|
| 348 |
//--- |
| 349 |
|
| 350 |
NsmSetInfo::NsmSetInfo(const TNsmPluginInitInfo &initInfo) |
| 351 |
: NsmInfoBase(initInfo), |
| 352 |
HSetConnectionInfo(GetService(NMS_SYSTEM_CONNECTION_SETINFO)), |
| 353 |
HSetConnectionMemberInfo(GetService(NMS_SYSTEM_CONNECTION_MEMBERS_SETINFO)), |
| 354 |
HSetConnectionGroupInfo(GetService(NMS_SYSTEM_CONNECTION_GROUPS_SETINFO)), |
| 355 |
HSetSessionInfo(GetService(NMS_SYSTEM_SESSION_SETINFO)), |
| 356 |
HSetSessionMemberInfo(GetService(NMS_SYSTEM_SESSION_MEMBERS_SETINFO)), |
| 357 |
HSetFileSessionInfo(GetService(NMS_SYSTEM_FILESESSION_SETINFO)) |
| 358 |
{} |
| 359 |
|
| 360 |
void NsmSetInfo::SetConnectionInfo(HNsmConnection handle, const PNsmInfo nsmInfo, int infoKey) const |
| 361 |
{ |
| 362 |
TNsmConnectionInfo cInfo = {0}; |
| 363 |
cInfo.cbSize = sizeof(TNsmConnectionInfo); |
| 364 |
cInfo.nInfoKey = infoKey; |
| 365 |
cInfo.lpInfo = nsmInfo; |
| 366 |
|
| 367 |
InitInfo.CallService(HSetConnectionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&cInfo)); |
| 368 |
} |
| 369 |
|
| 370 |
void NsmSetInfo::SetSessionInfo(HNsmSession handle, const PNsmInfo nsmInfo, int infoKey) const |
| 371 |
{ |
| 372 |
TNsmSessionInfo sInfo = {0}; |
| 373 |
sInfo.cbSize = sizeof(TNsmSessionInfo); |
| 374 |
sInfo.nInfoKey = infoKey; |
| 375 |
sInfo.lpInfo = nsmInfo; |
| 376 |
|
| 377 |
InitInfo.CallService(HSetSessionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&sInfo)); |
| 378 |
} |
| 379 |
|
| 380 |
void NsmSetInfo::SetFileSessionInfo(HNsmFileSession handle, const PNsmInfo nsmInfo, int infoKey) const |
| 381 |
{ |
| 382 |
TNsmFileSessionInfo fInfo = {0}; |
| 383 |
fInfo.cbSize = sizeof(TNsmFileSessionInfo); |
| 384 |
fInfo.nInfoKey = infoKey; |
| 385 |
fInfo.lpInfo = nsmInfo; |
| 386 |
|
| 387 |
InitInfo.CallService(HSetFileSessionInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&fInfo)); |
| 388 |
} |
| 389 |
|
| 390 |
void NsmSetInfo::SetGroupInfo(HNsmConnection handle, const PNsmInfo nsmInfo, int groupId, int infoKey, int flags) const |
| 391 |
{ |
| 392 |
TNsmGroupInfo gInfo = {0}; |
| 393 |
gInfo.cbSize = sizeof(TNsmGroupInfo); |
| 394 |
gInfo.nGroupId = groupId; |
| 395 |
gInfo.nInfoKey = infoKey; |
| 396 |
gInfo.lpInfo = nsmInfo; |
| 397 |
gInfo.nFlags = flags; |
| 398 |
|
| 399 |
InitInfo.CallService(HSetConnectionGroupInfo, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&gInfo)); |
| 400 |
} |
| 401 |
|
| 402 |
void NsmSetInfo::SetMemberInfo(HNsmService svc, void* handle, const PNsmInfo nsmInfo, const std::string &account, int infoKey, int flags, int listkind) const |
| 403 |
{ |
| 404 |
TNsmMemberInfo mInfo = {0}; |
| 405 |
mInfo.cbSize = sizeof(TNsmMemberInfo); |
| 406 |
mInfo.nListKind = listkind; |
| 407 |
mInfo.lpAccount = account.c_str(); |
| 408 |
mInfo.nInfoKey = infoKey; |
| 409 |
mInfo.lpInfo = nsmInfo; |
| 410 |
mInfo.nFlags = flags; |
| 411 |
|
| 412 |
InitInfo.CallService(svc, reinterpret_cast<WPARAM>(handle), reinterpret_cast<LPARAM>(&mInfo)); |
| 413 |
} |
| 414 |
|
| 415 |
//--- |
| 416 |
|
| 417 |
void NsmSetInfo::SetConnectionInfo(HNsmConnection handle, int infoKey, const std::wstring &value) const |
| 418 |
{ |
| 419 |
wchar_t buff[BufferSize] = {0}; |
| 420 |
|
| 421 |
TNsmInfo nsmInfo = {0}; |
| 422 |
nsmInfo.lpBuffer = buff; |
| 423 |
nsmInfo.nBufferSize = sizeof(buff); |
| 424 |
|
| 425 |
StrToNsmInfo(&nsmInfo,value); |
| 426 |
|
| 427 |
SetConnectionInfo(handle, &nsmInfo, infoKey); |
| 428 |
} |
| 429 |
|
| 430 |
void NsmSetInfo::SetConnectionInfo(HNsmConnection handle, int infoKey, int value) const |
| 431 |
{ |
| 432 |
int buff = 0; |
| 433 |
|
| 434 |
TNsmInfo nsmInfo = {0}; |
| 435 |
nsmInfo.lpBuffer = &buff; |
| 436 |
nsmInfo.nBufferSize = sizeof(buff); |
| 437 |
|
| 438 |
IntToNsmInfo(&nsmInfo,value); |
| 439 |
|
| 440 |
SetConnectionInfo(handle, &nsmInfo, infoKey); |
| 441 |
} |
| 442 |
|
| 443 |
void NsmSetInfo::SetConnectionInfo(HNsmConnection handle, int infoKey, bool value) const |
| 444 |
{ |
| 445 |
unsigned char buff = 0; |
| 446 |
|
| 447 |
TNsmInfo nsmInfo = {0}; |
| 448 |
nsmInfo.lpBuffer = &buff; |
| 449 |
nsmInfo.nBufferSize = sizeof(buff); |
| 450 |
|
| 451 |
BoolToNsmInfo(&nsmInfo,value); |
| 452 |
|
| 453 |
SetConnectionInfo(handle, &nsmInfo, infoKey); |
| 454 |
} |
| 455 |
|
| 456 |
void NsmSetInfo::SetSessionInfo(HNsmSession handle, int infoKey, const std::wstring &value) const |
| 457 |
{ |
| 458 |
wchar_t buff[BufferSize] = {0}; |
| 459 |
|
| 460 |
TNsmInfo nsmInfo = {0}; |
| 461 |
nsmInfo.lpBuffer = buff; |
| 462 |
nsmInfo.nBufferSize = sizeof(buff); |
| 463 |
|
| 464 |
StrToNsmInfo(&nsmInfo,value); |
| 465 |
|
| 466 |
SetSessionInfo(handle, &nsmInfo, infoKey); |
| 467 |
} |
| 468 |
|
| 469 |
void NsmSetInfo::SetSessionInfo(HNsmSession handle, int infoKey, int value) const |
| 470 |
{ |
| 471 |
int buff = 0; |
| 472 |
|
| 473 |
TNsmInfo nsmInfo = {0}; |
| 474 |
nsmInfo.lpBuffer = &buff; |
| 475 |
nsmInfo.nBufferSize = sizeof(buff); |
| 476 |
|
| 477 |
IntToNsmInfo(&nsmInfo,value); |
| 478 |
|
| 479 |
SetSessionInfo(handle, &nsmInfo, infoKey); |
| 480 |
} |
| 481 |
|
| 482 |
void NsmSetInfo::SetSessionInfo(HNsmSession handle, int infoKey, bool value) const |
| 483 |
{ |
| 484 |
unsigned char buff = 0; |
| 485 |
|
| 486 |
TNsmInfo nsmInfo = {0}; |
| 487 |
nsmInfo.lpBuffer = &buff; |
| 488 |
nsmInfo.nBufferSize = sizeof(buff); |
| 489 |
|
| 490 |
BoolToNsmInfo(&nsmInfo,value); |
| 491 |
|
| 492 |
SetSessionInfo(handle, &nsmInfo, infoKey); |
| 493 |
} |
| 494 |
|
| 495 |
void NsmSetInfo::SetFileSessionInfo(HNsmFileSession handle, int infoKey, const std::wstring &value) const |
| 496 |
{ |
| 497 |
wchar_t buff[BufferSize] = {0}; |
| 498 |
|
| 499 |
TNsmInfo nsmInfo = {0}; |
| 500 |
nsmInfo.lpBuffer = buff; |
| 501 |
nsmInfo.nBufferSize = sizeof(buff); |
| 502 |
|
| 503 |
StrToNsmInfo(&nsmInfo,value); |
| 504 |
|
| 505 |
SetFileSessionInfo(handle, &nsmInfo, infoKey); |
| 506 |
} |
| 507 |
|
| 508 |
void NsmSetInfo::SetFileSessionInfo(HNsmFileSession handle, int infoKey, int value) const |
| 509 |
{ |
| 510 |
int buff = 0; |
| 511 |
|
| 512 |
TNsmInfo nsmInfo = {0}; |
| 513 |
nsmInfo.lpBuffer = &buff; |
| 514 |
nsmInfo.nBufferSize = sizeof(buff); |
| 515 |
|
| 516 |
IntToNsmInfo(&nsmInfo,value); |
| 517 |
|
| 518 |
SetFileSessionInfo(handle, &nsmInfo, infoKey); |
| 519 |
} |
| 520 |
|
| 521 |
void NsmSetInfo::SetFileSessionInfo(HNsmFileSession handle, int infoKey, INT64 value) const |
| 522 |
{ |
| 523 |
INT64 buff = 0; |
| 524 |
|
| 525 |
TNsmInfo nsmInfo = {0}; |
| 526 |
nsmInfo.lpBuffer = &buff; |
| 527 |
nsmInfo.nBufferSize = sizeof(buff); |
| 528 |
|
| 529 |
Int64ToNsmInfo(&nsmInfo,value); |
| 530 |
|
| 531 |
SetFileSessionInfo(handle, &nsmInfo, infoKey); |
| 532 |
} |
| 533 |
|
| 534 |
void NsmSetInfo::SetFileSessionInfo(HNsmFileSession handle, int infoKey, bool value) const |
| 535 |
{ |
| 536 |
unsigned char buff = 0; |
| 537 |
|
| 538 |
TNsmInfo nsmInfo = {0}; |
| 539 |
nsmInfo.lpBuffer = &buff; |
| 540 |
nsmInfo.nBufferSize = sizeof(buff); |
| 541 |
|
| 542 |
BoolToNsmInfo(&nsmInfo,value); |
| 543 |
|
| 544 |
SetFileSessionInfo(handle, &nsmInfo, infoKey); |
| 545 |
} |
| 546 |
|
| 547 |
void NsmSetInfo::SetGroupInfo(HNsmConnection handle, int groupID, int infoKey, const std::wstring &value, int flags) const |
| 548 |
{ |
| 549 |
wchar_t buff[BufferSize] = {0}; |
| 550 |
|
| 551 |
TNsmInfo nsmInfo = {0}; |
| 552 |
nsmInfo.lpBuffer = buff; |
| 553 |
nsmInfo.nBufferSize = sizeof(buff); |
| 554 |
|
| 555 |
StrToNsmInfo(&nsmInfo,value); |
| 556 |
|
| 557 |
SetGroupInfo(handle, &nsmInfo, groupID, infoKey, flags); |
| 558 |
} |
| 559 |
|
| 560 |
void NsmSetInfo::SetGroupInfo(HNsmConnection handle, int groupID, int infoKey, int value, int flags) const |
| 561 |
{ |
| 562 |
int buff = 0; |
| 563 |
|
| 564 |
TNsmInfo nsmInfo = {0}; |
| 565 |
nsmInfo.lpBuffer = &buff; |
| 566 |
nsmInfo.nBufferSize = sizeof(buff); |
| 567 |
|
| 568 |
IntToNsmInfo(&nsmInfo,value); |
| 569 |
|
| 570 |
SetGroupInfo(handle, &nsmInfo, groupID, infoKey, flags); |
| 571 |
} |
| 572 |
|
| 573 |
void NsmSetInfo::SetGroupInfo(HNsmConnection handle, int groupID, int infoKey, bool value, int flags) const |
| 574 |
{ |
| 575 |
unsigned char buff = 0; |
| 576 |
|
| 577 |
TNsmInfo nsmInfo = {0}; |
| 578 |
nsmInfo.lpBuffer = &buff; |
| 579 |
nsmInfo.nBufferSize = sizeof(buff); |
| 580 |
|
| 581 |
BoolToNsmInfo(&nsmInfo,value); |
| 582 |
|
| 583 |
SetGroupInfo(handle, &nsmInfo, groupID, infoKey, flags); |
| 584 |
} |
| 585 |
|
| 586 |
void NsmSetInfo::SetMemberInfo(HNsmConnection handle, const std::string &account, int infoKey, const std::wstring &value, int listKind, int flags) const |
| 587 |
{ |
| 588 |
wchar_t buff[BufferSize] = {0}; |
| 589 |
|
| 590 |
TNsmInfo nsmInfo = {0}; |
| 591 |
nsmInfo.lpBuffer = buff; |
| 592 |
nsmInfo.nBufferSize = sizeof(buff); |
| 593 |
|
| 594 |
StrToNsmInfo(&nsmInfo,value); |
| 595 |
|
| 596 |
SetMemberInfo(HSetConnectionMemberInfo, handle, &nsmInfo, account, infoKey, flags, listKind); |
| 597 |
} |
| 598 |
|
| 599 |
void NsmSetInfo::SetMemberInfo(HNsmConnection handle, const std::string &account, int infoKey, int value, int listKind, int flags) const |
| 600 |
{ |
| 601 |
int buff = 0; |
| 602 |
|
| 603 |
TNsmInfo nsmInfo = {0}; |
| 604 |
nsmInfo.lpBuffer = &buff; |
| 605 |
nsmInfo.nBufferSize = sizeof(buff); |
| 606 |
|
| 607 |
IntToNsmInfo(&nsmInfo,value); |
| 608 |
|
| 609 |
SetMemberInfo(HSetConnectionMemberInfo, handle, &nsmInfo, account, infoKey, flags, listKind); |
| 610 |
} |
| 611 |
|
| 612 |
void NsmSetInfo::SetSessionMemberInfo(HNsmSession handle, const std::string &account, int infoKey, const std::wstring &value) const |
| 613 |
{ |
| 614 |
wchar_t buff[BufferSize] = {0}; |
| 615 |
|
| 616 |
TNsmInfo nsmInfo = {0}; |
| 617 |
nsmInfo.lpBuffer = buff; |
| 618 |
nsmInfo.nBufferSize = sizeof(buff); |
| 619 |
|
| 620 |
StrToNsmInfo(&nsmInfo,value); |
| 621 |
|
| 622 |
SetMemberInfo(HSetSessionMemberInfo, handle, &nsmInfo, account, infoKey); |
| 623 |
} |
| 624 |
|
| 625 |
void NsmSetInfo::SetSessionMemberInfo(HNsmSession handle, const std::string &account, int infoKey, int value) const |
| 626 |
{ |
| 627 |
int buff = 0; |
| 628 |
|
| 629 |
TNsmInfo nsmInfo = {0}; |
| 630 |
nsmInfo.lpBuffer = &buff; |
| 631 |
nsmInfo.nBufferSize = sizeof(buff); |
| 632 |
|
| 633 |
IntToNsmInfo(&nsmInfo,value); |
| 634 |
|
| 635 |
SetMemberInfo(HSetSessionMemberInfo, handle, &nsmInfo, account, infoKey); |
| 636 |
} |
| 637 |
|
| 638 |
void NsmSetInfo::SetSessionMemberInfo(HNsmSession handle, const std::string &account, int infoKey, bool value) const |
| 639 |
{ |
| 640 |
unsigned char buff = 0; |
| 641 |
|
| 642 |
TNsmInfo nsmInfo = {0}; |
| 643 |
nsmInfo.lpBuffer = &buff; |
| 644 |
nsmInfo.nBufferSize = sizeof(buff); |
| 645 |
|
| 646 |
BoolToNsmInfo(&nsmInfo,value); |
| 647 |
|
| 648 |
SetMemberInfo(HSetSessionMemberInfo, handle, &nsmInfo, account, infoKey); |
| 649 |
} |
| 650 |
|
| 651 |
//--- |
| 652 |
|
| 653 |
NsmGetSetInfo::NsmGetSetInfo(const TNsmPluginInitInfo &initInfo) |
| 654 |
: NsmInfoBase(initInfo), NsmGetInfo(initInfo), NsmSetInfo(initInfo) |
| 655 |
{} |
| 656 |
} |
| 657 |
} |
| 658 |
} |