Пример #1
0
static gboolean skype_check_missedmessages(gpointer data) {
	Skype *skype = (Skype *) data;

	skype->send_command("SEARCH MISSEDCHATMESSAGES");

	return TRUE;
}
Пример #2
0
		void handleMessageSendRequest(const std::string &user, const std::string &legacyName, const std::string &message, const std::string &xhtml) {
			Skype *skype = m_sessions[user];
			if (skype) {
				skype->send_command("MESSAGE " + legacyName + " " + message);
			}
			
		}
Пример #3
0
		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);
			}
Пример #4
0
		void handleBuddyRemovedRequest(const std::string &user, const std::string &buddyName, const std::vector<std::string> &groups) {
			Skype *skype = m_sessions[user];
			if (skype) {
				skype->send_command("SET USER " + buddyName + " BUDDYSTATUS 1");
			}
		}