void ICQClient::sendCapability() { Buffer cap; capability c; memcpy(c, capabilities[CAP_SIM], sizeof(c)); const char *ver = VERSION; unsigned char *pack_ver = c + sizeof(capability) - 4; *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); unsigned char os_ver; #ifdef WIN32 os_ver = 0x80; #else os_ver = 0; #endif *(pack_ver++) = os_ver; cap.pack((char*)capabilities[CAP_DIRECT], sizeof(capability)); cap.pack((char*)capabilities[CAP_SRV_RELAY], sizeof(capability)); if (getSendFormat() <= 1) cap.pack((char*)capabilities[CAP_UTF], sizeof(capability)); if (getSendFormat() == 0) cap.pack((char*)capabilities[CAP_RTF], sizeof(capability)); if (getTypingNotification()) cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability)); cap.pack((char*)c, sizeof(c)); snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO); m_socket->writeBuffer.tlv(0x0005, cap); sendPacket(); }
void ICQClient::sendCapability(const QString &away_msg) { Buffer cap; capability c; memcpy(c, capabilities[CAP_SIM], sizeof(c)); const char *ver = VERSION; unsigned char *pack_ver = c + sizeof(capability) - 4; *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); unsigned char os_ver; #ifdef WIN32 os_ver = 0x80; #else #ifdef QT_MACOSX_VERSION os_ver = 0x40; #else os_ver = 0; #endif #endif *(pack_ver++) = os_ver; addCapability(cap, CAP_AIM_SHORTCAPS); addCapability(cap, CAP_AIM_SUPPORT); // addCapability(cap, CAP_AVATAR); if (m_bAIM){ addCapability(cap, CAP_AIM_CHAT); addCapability(cap, CAP_AIM_BUDDYCON); addCapability(cap, CAP_AIM_IMIMAGE); addCapability(cap, CAP_AIM_SENDFILE); addCapability(cap, CAP_AIM_BUDDYLIST); }else{ addCapability(cap, CAP_DIRECT); addCapability(cap, CAP_SRV_RELAY); addCapability(cap, CAP_XTRAZ); if (getSendFormat() <= 1) addCapability(cap, CAP_UTF); if (getSendFormat() == 0) addCapability(cap, CAP_RTF); } if (!getDisableTypingNotification()) cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability)); cap.pack((char*)c, sizeof(c)); snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO); if (m_bAIM){ if (data.owner.ProfileFetch.bValue){ QString profile; profile = QString("<HTML>") + data.owner.About.ptr + "</HTML>"; encodeString(profile, "text/aolrtf", 1, 2); } if (!away_msg.isNull()) encodeString(away_msg, "text/plain", 3, 4); } m_socket->writeBuffer.tlv(0x0005, cap); if (m_bAIM) m_socket->writeBuffer.tlv(0x0006, "\x00\x04\x00\x02\x00\x02", 6); sendPacket(true); }
void ICQClient::sendCapability(const char *away_msg) { Buffer cap; capability c; memcpy(c, capabilities[CAP_SIM], sizeof(c)); const char *ver = VERSION; unsigned char *pack_ver = c + sizeof(capability) - 4; *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); *(pack_ver++) = get_ver(ver); unsigned char os_ver; #ifdef WIN32 os_ver = 0x80; #else #ifdef QT_MACOSX_VERSION os_ver = 0x40; #else os_ver = 0; #endif #endif *(pack_ver++) = os_ver; if (m_bAIM) { cap.pack((char*)capabilities[CAP_AIM_CHAT], sizeof(capability)); cap.pack((char*)capabilities[CAP_AIM_BUDDYCON], sizeof(capability)); cap.pack((char*)capabilities[CAP_AIM_IMIMAGE], sizeof(capability)); cap.pack((char*)capabilities[CAP_AIM_SENDFILE], sizeof(capability)); cap.pack((char*)capabilities[CAP_AIM_BUDDYLIST], sizeof(capability)); } else { cap.pack((char*)capabilities[CAP_DIRECT], sizeof(capability)); cap.pack((char*)capabilities[CAP_SRV_RELAY], sizeof(capability)); if (getSendFormat() <= 1) cap.pack((char*)capabilities[CAP_UTF], sizeof(capability)); if (getSendFormat() == 0) cap.pack((char*)capabilities[CAP_RTF], sizeof(capability)); } if (getTypingNotification()) cap.pack((char*)capabilities[CAP_TYPING], sizeof(capability)); cap.pack((char*)capabilities[CAP_AIM_SUPPORT], sizeof(capability)); cap.pack((char*)c, sizeof(c)); snac(ICQ_SNACxFAM_LOCATION, ICQ_SNACxLOC_SETxUSERxINFO); if (m_bAIM) { if (data.owner.ProfileFetch.bValue) { QString profile; if (data.owner.About.ptr) profile = QString::fromUtf8(data.owner.About.ptr); profile = QString("<HTML>") + profile + "</HTML>"; encodeString(profile, "text/aolrtf", 1, 2); } if (away_msg) encodeString(QString::fromUtf8(away_msg), "text/plain", 3, 4); } m_socket->writeBuffer.tlv(0x0005, cap); if (m_bAIM) m_socket->writeBuffer.tlv(0x0006, "\x00\x04\x00\x02\x00\x02", 6); sendPacket(); }
const char *mupnp_http_getservername(char *buf, size_t bufSize) { #if defined(WIN32) && !defined(ITRON) OSVERSIONINFO verInfo; mupnp_strcpy(buf, "Platform 1.0"); ZeroMemory(&verInfo, sizeof(OSVERSIONINFO)); verInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx(&verInfo)) { #if defined(HAVE_SNPRINTF) snprintf(buf, bufSize, "Windows %d.%d", verInfo.dwMajorVersion, verInfo.dwMinorVersion); #else sprintf(buf, "Windows %d.%d", verInfo.dwMajorVersion, verInfo.dwMinorVersion); #endif } #elif defined(BTRON) T_VER verInfo; mupnp_strcpy(buf, "Platform 1.0"); if (get_ver(&verInfo) == 0) { #if defined(HAVE_SNPRINTF) snprintf(buf, bufSize, "BTRON %hd", verInfo.spver); #else sprintf(buf, "BTRON %hd", verInfo.spver); #endif } #elif defined(ITRON) mupnp_strcpy(buf, "uITRON 4.0"); #elif defined(TENGINE) mupnp_strcpy(buf, "T-Engine 1.0"); #elif defined(HAVE_UNAME) || defined(TARGET_OS_MAC) || defined(TARGET_OS_IPHONE) struct utsname unameBuf; mupnp_strcpy(buf, "Platform 1.0"); if (uname(&unameBuf) == 0) { #if defined(HAVE_SNPRINTF) snprintf(buf, bufSize, "%s %s", unameBuf.sysname, unameBuf.release); #else sprintf(buf, "%s %s", unameBuf.sysname, unameBuf.release); #endif } #else mupnp_strcpy(buf, "Platform 1.0"); #endif mupnp_log_debug_l4("Entering...\n"); return buf; mupnp_log_debug_l4("Leaving...\n"); }
void ProviderManagerMap::initialize() { String libExt = FileSystem::getDynamicLibraryExtension(); // first add the default: ProvMgrIfcInfo defaultPMEntry; defaultPMEntry.path.clear(); defaultPMEntry.ifcName = "C++Default"; defaultPMEntry.ifcVersions.append(String("2.1.0")); defaultPMEntry.ifcVersions.append(String("2.2.0")); defaultPMEntry.ifcVersions.append(String("2.3.0")); defaultPMEntry.ifcVersions.append(String("2.5.0")); defaultPMEntry.ifcVersions.append(String("2.6.0")); defaultPMEntry.ifcVersions.append(String("2.9.0")); _pmArray.append(defaultPMEntry); // now check for plugins String dirName = ConfigManager::getInstance()->getCurrentValue( "providerManagerDir"); dirName = ConfigManager::getHomedPath(dirName); PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, "Looking for ProviderManagers in %s.", (const char*)dirName.getCString())); // check to make sure that this ifc type is handled by one of the // provider managers in the directory String testname = String("providermanager")+libExt; for (Dir dir(dirName); dir.more(); dir.next()) { String filename = dir.getName(); String lowerFilename = filename; lowerFilename.toLower(); if ((lowerFilename.subString(lowerFilename.size()-testname.size()) == testname) && (lowerFilename != FileSystem::buildLibraryFileName("defaultprovidermanager")) && (lowerFilename != FileSystem::buildLibraryFileName("pegprovidermanager"))) { String fullPath = dirName + "/" + filename; // found a file... assume it's a ProviderManager library PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4, "Found file %s. Checking to see if it is a ProviderManager.", (const char*)fullPath.getCString())); DynamicLibrary dl(fullPath); if (!dl.load()) { Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, MessageLoaderParms( "Server.ProviderRegistrationManager.ProviderManagerMap." "LOAD_ERROR", "Error loading library $0: $1.", fullPath, dl.getLoadErrorMessage())); continue; // to the next file } Uint32 (*get_peg_ver)() = (Uint32(*)()) dl.getSymbol("getPegasusVersion"); if (get_peg_ver == 0) { Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, MessageLoaderParms( "Server.ProviderRegistrationManager.ProviderManagerMap." "MISSING_GET_PG_VERSION", "Library $0 does not contain expected function " "'getPegasusVersion'.", fullPath)); continue; } Uint32 peg_ver = get_peg_ver(); if (peg_ver != PEGASUS_VERSION_NUMBER) { Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, MessageLoaderParms( "Server.ProviderRegistrationManager.ProviderManagerMap." "WRONG_VERSION", "Provider Manager $0 returned Pegasus " "version $1. Expected $2.", fullPath, peg_ver, PEGASUS_VERSION_NUMBER)); continue; } const char** (*get_ifc)() = (const char**(*)()) dl.getSymbol( "getProviderManagerInterfaceNames"); const char** (*get_ver)(const char *) = (const char**(*)(const char *)) dl.getSymbol( "getProviderManagerInterfaceVersions"); if (get_ifc == 0) { Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, MessageLoaderParms( "Server.ProviderRegistrationManager.ProviderManagerMap." "MISSING_GET_IFC_NAMES", "Provider Manager $0 does not contain expected " "function 'getProviderManagerInterfaceNames'", fullPath)); continue; // to the next file } if (get_ver == 0) { Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE, MessageLoaderParms( "Server.ProviderRegistrationManager.ProviderManagerMap." "MISSING_GET_IFC_VERSIONS", "Provider Manager $0 does not contain expected " "function 'getProviderManagerInterfaceVersions'", fullPath)); continue; // to the next file } const char ** ifcNames = get_ifc(); if ((ifcNames!=NULL) && (*ifcNames!=NULL)) { for (int i=0; ifcNames[i]!=NULL; i++) { const char *ifcName = ifcNames[i]; ProvMgrIfcInfo entry; entry.path = fullPath; entry.ifcName = ifcName; // now get the versions const char ** ifcVersions = get_ver(ifcName); for (int j=0; ifcVersions[j]!=NULL; j++) { entry.ifcVersions.append(String(ifcVersions[j])); PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL3, "Adding Provider type %s version %s " "handled by ProviderManager %s", ifcName,ifcVersions[j], (const char*)fullPath.getCString())); } _pmArray.append(entry); } } } } _bInitialized = true; }