当前位置: 首页>>代码示例>>C++>>正文


C++ Skype::getUsername方法代码示例

本文整理汇总了C++中Skype::getUsername方法的典型用法代码示例。如果您正苦于以下问题:C++ Skype::getUsername方法的具体用法?C++ Skype::getUsername怎么用?C++ Skype::getUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Skype的用法示例。


在下文中一共展示了Skype::getUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleVCardRequest

		void handleVCardRequest(const std::string &user, const std::string &legacyName, unsigned int id) {
			Skype *skype = m_sessions[user];
			if (skype) {
				std::string name = legacyName;
				if (name.find("skype.") == 0) {
					name = name.substr(6);
				}
				std::string photo;
				gchar *filename = NULL;
				gchar *new_filename = NULL;
				gchar *image_data = NULL;
				gsize image_data_len = 0;
				gchar *ret;
				int fh;
				GError *error;
				const gchar *userfiles[] = {"user256", "user1024", "user4096", "user16384", "user32768", "user65536",
											"profile256", "profile1024", "profile4096", "profile16384", "profile32768", 
											NULL};
				char *username = g_strdup_printf("\x03\x10%s", name.c_str());
				for (fh = 0; userfiles[fh]; fh++) {
					filename = g_strconcat("/tmp/skype/", skype->getUsername().c_str(), "/", skype->getUsername().c_str(), "/", userfiles[fh], ".dbb", NULL);
					std::cout << "getting filename:" << filename << "\n";
					if (g_file_get_contents(filename, &image_data, &image_data_len, NULL))
					{
						std::cout << "got\n";
						char *start = (char *)memmem(image_data, image_data_len, username, strlen(username)+1);
						if (start != NULL)
						{
							char *next = image_data;
							char *last = next;
							//find last index of l33l
							while ((next = (char *)memmem(next+4, start-next-4, "l33l", 4)))
							{
								last = next;
							}
							start = last;
							if (start != NULL)
							{
								char *img_start;
								//find end of l33l block
								char *end = (char *)memmem(start+4, image_data+image_data_len-start-4, "l33l", 4);
								if (!end) end = image_data+image_data_len;
								
								//look for start of JPEG block
								img_start = (char *)memmem(start, end-start, "\xFF\xD8", 2);
								if (img_start)
								{
									//look for end of JPEG block
									char *img_end = (char *)memmem(img_start, end-img_start, "\xFF\xD9", 2);
									if (img_end)
									{
										image_data_len = img_end - img_start + 2;
										photo = std::string(img_start, image_data_len);
									}
								}
							}
						}
						g_free(image_data);
					}
					g_free(filename);
				}
				g_free(username);
				
				std::string alias = "";
				std::cout << skype->getUsername() << " " << name << "\n";
				if (skype->getUsername() == name) {
					alias = skype->send_command("GET PROFILE FULLNAME");
					alias = GET_RESPONSE_DATA(alias, "FULLNAME")
				}
				handleVCard(user, id, legacyName, "", alias, photo);
			}
开发者ID:arnt,项目名称:libtransport,代码行数:71,代码来源:main.cpp


注:本文中的Skype::getUsername方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。