Hello community, here is the log from the commit of package skype4pidgin for openSUSE:Factory checked in at 2016-08-12 15:57:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/skype4pidgin (Old) and /work/SRC/openSUSE:Factory/.skype4pidgin.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "skype4pidgin" Changes: -------- --- /work/SRC/openSUSE:Factory/skype4pidgin/skype4pidgin.changes 2016-03-29 10:39:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.skype4pidgin.new/skype4pidgin.changes 2016-08-12 15:57:10.000000000 +0200 @@ -1,0 +2,18 @@ +Thu Aug 11 15:02:32 UTC 2016 - [email protected] + +- Update to version 1.2.1: + * Fix Outlook (email address) logins. + * Faster logins and less "registration token expired" + disconnects. + * Fix the "Search for friends..." box (properly this time). + * Allow setting 'mood' messages (properly this time). + +------------------------------------------------------------------- +Sat Jul 30 18:24:12 UTC 2016 - [email protected] + +- Update to version 1.2: + * Add support for libpurple 2.11+. + * Fix the "Search for friends…" box. + * Allow setting 'mood' messages. + +------------------------------------------------------------------- Old: ---- skype4pidgin-1.1.tar.gz New: ---- skype4pidgin-1.2.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ skype4pidgin.spec ++++++ --- /var/tmp/diff_new_pack.ZziUnW/_old 2016-08-12 15:57:11.000000000 +0200 +++ /var/tmp/diff_new_pack.ZziUnW/_new 2016-08-12 15:57:11.000000000 +0200 @@ -17,7 +17,7 @@ Name: skype4pidgin -Version: 1.1 +Version: 1.2.1 Release: 0 Summary: Libpurple plugin for Skype API License: GPL-3.0+ @@ -34,6 +34,7 @@ BuildRequires: libpurple-devel # For directory ownership. BuildRequires: pidgin +BuildRequires: pkgconfig BuildRequires: xorg-x11-libX11-devel BuildRequires: zlib-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ skype4pidgin-1.1.tar.gz -> skype4pidgin-1.2.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/README.md new/skype4pidgin-1.2.1/README.md --- old/skype4pidgin-1.1/README.md 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/README.md 2016-08-08 09:32:12.000000000 +0200 @@ -30,7 +30,7 @@ Known Issues ============ -* No notification popup on file being received/notificaitons (Windows) +* No notification popup on file being received/notifications (Windows) * Skype sounds still play even when it's hidden diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/po/ru.po new/skype4pidgin-1.2.1/po/ru.po --- old/skype4pidgin-1.1/po/ru.po 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/po/ru.po 2016-08-08 09:32:12.000000000 +0200 @@ -29,7 +29,7 @@ msgstr "У Вас самая свежая версия Skype" msgid "You have the latest version of the Skype plugin" -msgstr "У Вас самая свежия версия Pidgin/Skype плагина" +msgstr "У Вас самая свежая версия Pidgin/Skype плагина" msgid "Your version:" msgstr "Ваша версия:" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/CMakeLists.txt new/skype4pidgin-1.2.1/skypeweb/CMakeLists.txt --- old/skype4pidgin-1.1/skypeweb/CMakeLists.txt 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/CMakeLists.txt 2016-08-08 09:32:12.000000000 +0200 @@ -2,8 +2,8 @@ set(PROJECT_NAME "skypeweb") set(VERSION_MAJOR "1") -set(VERSION_MINOR "1") -set(VERSION_PATCH "0") +set(VERSION_MINOR "2") +set(VERSION_PATCH "1") project(${PROJECT_NAME}) @@ -51,18 +51,32 @@ #install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) -exec_program("pkg-config --variable=plugindir purple 2>/dev/null" - OUTPUT_VARIABLE LIB_INSTALL_DIR) +exec_program("${PKG_CONFIG_EXECUTABLE} --variable=plugindir purple 2>/dev/null" + OUTPUT_VARIABLE LIB_INSTALL_DIR + RETURN_VALUE PURPLE_PLUGINDIR_RET) + +if (NOT PURPLE_PLUGINDIR_RET EQUAL 0) + message( FATAL_ERROR "${PKG_CONFIG_EXECUTABLE} --variable=plugindir purple -- returned a non-null error code") +endif() install(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR}) -exec_program("pkg-config --variable=datadir purple 2>/dev/null" - OUTPUT_VARIABLE PURPLE_DATADIR) +exec_program("${PKG_CONFIG_EXECUTABLE} --variable=datadir purple 2>/dev/null" + OUTPUT_VARIABLE PURPLE_DATADIR + RETURN_VALUE PURPLE_DATADIR_RET) + +if (NOT PURPLE_DATADIR_RET EQUAL 0) + message( FATAL_ERROR "${PKG_CONFIG_EXECUTABLE} --variable=datadir purple -- returned a non-null error code") +endif() install(DIRECTORY "icons/" DESTINATION "${PURPLE_DATADIR}/pixmaps/pidgin/protocols/" ) +install(FILES "theme" + DESTINATION "${PURPLE_DATADIR}/pixmaps/pidgin/emotes/skype/" + ) + # package settings set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Skype protocol plug-in for libpurple") set(CPACK_PACKAGE_VENDOR "Eionrobb") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/Makefile new/skype4pidgin-1.2.1/skypeweb/Makefile --- old/skype4pidgin-1.1/skypeweb/Makefile 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/Makefile 2016-08-08 09:32:12.000000000 +0200 @@ -5,8 +5,8 @@ DIR_PERM = 0755 FILE_PERM = 0644 -LIBPURPLE_CFLAGS += $(shell $(PKG_CONFIG) --cflags glib-2.0 json-glib-1.0 purple) -LIBPURPLE_LIBS += $(shell $(PKG_CONFIG) --libs glib-2.0 json-glib-1.0 purple) +LIBPURPLE_CFLAGS += $(shell $(PKG_CONFIG) --cflags glib-2.0 json-glib-1.0 purple zlib) +LIBPURPLE_LIBS += $(shell $(PKG_CONFIG) --libs glib-2.0 json-glib-1.0 purple zlib) PLUGIN_DIR_PURPLE = $(shell $(PKG_CONFIG) --variable=plugindir purple) DATA_ROOT_DIR_PURPLE = $(shell $(PKG_CONFIG) --variable=datarootdir purple) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/Makefile.eion new/skype4pidgin-1.2.1/skypeweb/Makefile.eion --- old/skype4pidgin-1.1/skypeweb/Makefile.eion 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/Makefile.eion 2016-08-08 09:32:12.000000000 +0200 @@ -2,7 +2,7 @@ LINUX32_COMPILER = i686-pc-linux-gnu-gcc LINUX64_COMPILER = x86_64-pc-linux-gnu-gcc #WIN32_COMPILER = /usr/bin/i586-mingw32-gcc -WIN32_COMPILER = gcc.exe +WIN32_COMPILER = /home/Eion/win32-dev/mingw/bin/gcc.exe WIN32_WINDRES = i586-mingw32-windres #WIN32_OBJCOPY = i586-mingw32-objcopy WIN32_OBJCOPY = objcopy.exe @@ -11,12 +11,12 @@ LINUX_PPC_COMPILER = powerpc-unknown-linux-gnu-gcc FREEBSD60_COMPILER = i686-pc-freebsd6.0-gcc MACPORT_COMPILER = i686-apple-darwin10-gcc-4.0.1 -MAKENSIS ?= /cygdrive/C/Program\ Files\ \(x86\)/NSIS/makensis.exe +MAKENSIS ?= "$(PROGRAMFILES)/NSIS/makensis.exe" LIBPURPLE_CFLAGS = -I/usr/include/libpurple -I/usr/local/include/libpurple -DPURPLE_PLUGINS -DENABLE_NLS -DHAVE_ZLIB GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include -I/usr/include/json-glib-1.0 -ljson-glib-1.0 WIN32_DEV_DIR = C:/cygwin/home/Eion/win32-dev -WIN32_PIDGIN_DIR = C:/cygwin/home/Eion/pidgin-2.10.4 +WIN32_PIDGIN_DIR = C:/cygwin/home/Eion/pidgin-2.10.12 WIN32_CFLAGS = -I${WIN32_DEV_DIR}/gtk_2_0-2.14/include/glib-2.0 -I${WIN32_PIDGIN_DIR}/libpurple/win32 -I${WIN32_DEV_DIR}/gtk_2_0-2.14/include -I${WIN32_DEV_DIR}/gtk_2_0-2.14/include/glib-2.0 -I${WIN32_DEV_DIR}/gtk_2_0-2.14/lib/glib-2.0/include -I${WIN32_DEV_DIR}/json-glib-0.8.0 -Wno-format -I${WIN32_PIDGIN_DIR}/libpurple -I${WIN32_DEV_DIR}/nss-3.12.5-nspr-4.8.2/include WIN32_LIBS = -L${WIN32_DEV_DIR}/gtk_2_0-2.14/lib -L${WIN32_PIDGIN_DIR}/libpurple -L${WIN32_DEV_DIR}/nss-3.12.5-nspr-4.8.2/lib -lglib-2.0 -lgobject-2.0 -lintl -lpurple -lws2_32 -L. -ljson-glib-1.0 -lz -lnss3 MACPORT_CFLAGS = -I/opt/local/include/libpurple -DPURPLE_PLUGINS -DENABLE_NLS -DHAVE_ZLIB -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/json-glib-1.0 -arch i386 -arch ppc -dynamiclib -L/opt/local/lib -ljson-glib-1.0 -lpurple -lglib-2.0 -lgobject-2.0 -lintl -lz -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 @@ -37,27 +37,21 @@ all: libskypeweb.dll -install: +install: libskypeweb-debug.dll + cp libskypeweb-debug.dll "$(PROGRAMFILES)/Pidgin/plugins/" installers: libskypeweb.dll pidgin-skypeweb.nsi - date=`date +%d-%b-%Y` && sed "s/PRODUCT_VERSION \"[-a-z0-9A-Z]*\"/PRODUCT_VERSION \"$$date\"/" -i pidgin-skypeweb.nsi - $(MAKENSIS) \ - -DPIDGIN_VARIANT="Pidgin" \ - -DPRODUCT_NAME="pidgin-skypeweb" \ - -DINSTALLER_NAME="pidgin-skypeweb-installer" \ - -DPRODUCT_VERSION="$(shell date +%d-%b-%Y)" \ - -JSON_GLIB_DLL="libjson-glib-1.0.dll" \ - pidgin-skypeweb.nsi > /dev/null + $(MAKENSIS) "/DPIDGIN_VARIANT"="Pidgin" "/DPRODUCT_NAME"="pidgin-skypeweb" "/DINSTALLER_NAME"="pidgin-skypeweb-installer" "/DJSON_GLIB_DLL"="libjson-glib-1.0.dll" pidgin-skypeweb.nsi clean: rm -f libskypeweb.dll libskypeweb.dll: ${SKYPEWEB_SOURCES} - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O2 -pipe ${SKYPEWEB_SOURCES} -o $@ -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} + ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -static-libgcc -Wall -I. -g -ggdb -O2 -pipe ${SKYPEWEB_SOURCES} -o $@ -shared ${WIN32_CFLAGS} ${WIN32_LIBS} ${WIN32_OBJCOPY} --only-keep-debug $@ [email protected] ${WIN32_OBJCOPY} --strip-debug $@ ${WIN32_OBJCOPY} [email protected] $@ upx libskypeweb.dll libskypeweb-debug.dll: ${SKYPEWEB_SOURCES} - ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -Wall -I. -g -O0 -pipe ${SKYPEWEB_SOURCES} -o $@ -shared -mno-cygwin ${WIN32_CFLAGS} ${WIN32_LIBS} + ${WIN32_COMPILER} ${LIBPURPLE_CFLAGS} -static-libgcc -Wall -Wno-unused-but-set-variable -Wno-unused-variable -I. -g -ggdb -O0 -pipe ${SKYPEWEB_SOURCES} -o $@ -shared ${WIN32_CFLAGS} ${WIN32_LIBS} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/README.md new/skype4pidgin-1.2.1/skypeweb/README.md --- old/skype4pidgin-1.1/skypeweb/README.md 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/README.md 2016-08-08 09:32:12.000000000 +0200 @@ -5,12 +5,51 @@ Download latest releases from [here](https://github.com/EionRobb/skype4pidgin/releases) +Change Log +---------- + * 1.2.1 - Fixes support for Live logins again, fixes setting mood message setting, fixes friend search, hopefully less disconnects + * 1.2 - Adds support for libpurple 2.11.0, allows setting "mood" messages + * 1.1 - Support file transfers, fix for Live logins, fix for other crashes + * 1.0 - Support Live (email address) logins + +Issues +------ +Before posting an issue, please check  + Windows ------- Windows users can download latest builds from [here](https://github.com/EionRobb/skype4pidgin/releases) The plugin requires libjson-glib which is part of the installer exe or can be downloaded [from github](https://github.com/EionRobb/skype4pidgin/raw/master/skypeweb/libjson-glib-1.0.dll) and copied to the Program Files\Pidgin folder (not the plugins subfolder) +Fedora +--------- +On Fedora you can install [package](https://apps.fedoraproject.org/packages/purple-skypeweb) from Fedora's main repository: +``` + sudo dnf install purple-skypeweb pidgin-skypeweb +``` + +CentOS/RHEL +--------- +On CentOS/RHEL you can install [package](https://apps.fedoraproject.org/packages/purple-skypeweb) from Fedora's [EPEL7](http://fedoraproject.org/wiki/EPEL) repository: + +``` + sudo yum install purple-skypeweb pidgin-skypeweb +``` + +Arch Linux +---------- +On Arch Linux package available in [Community](https://wiki.archlinux.org/index.php/official_repositories#community) repository. Installation is usual: +``` + sudo pacman -S purple-skypeweb +``` + +openSUSE +-------- +On openSUSE you can install the [package](https://software.opensuse.org/package/pidgin-plugin-skypeweb) using +``` + sudo zypper in pidgin-plugin-skypeweb +``` Compiling --------- @@ -39,7 +78,7 @@ --------- Requires devel headers/libs for libpurple and json-glib, gcc compiler and cmake ``` - sudo apt install libpurple-dev libjson-glib-dev cmake gcc + sudo apt-get install libpurple-dev libjson-glib-dev cmake gcc git clone git://github.com/EionRobb/skype4pidgin.git cd skype4pidgin/skypeweb mkdir build @@ -49,29 +88,32 @@ ``` To install do: ``` - sudo dpkg -i skypeweb-0.1.0-Linux.deb + sudo dpkg -i skypeweb-1.1.0-Linux.deb ``` - Building AUR package for Arch Linux ---------- [AUR Package Site](https://aur.archlinux.org/packages/purple-skypeweb) First you will need to get the [build deps](https://wiki.archlinux.org/index.php/Arch_User_Repository#Prerequisites) unless you already have them ``` -# pacman -S --needed base-devel + sudo pacman -S --needed base-devel ``` Next, clone the package's [AUR git repo](https://aur.archlinux.org/purple-skypeweb.git) ``` -$ git clone https://aur.archlinux.org/purple-skypeweb.git + git clone https://aur.archlinux.org/purple-skypeweb.git ``` Finally, [build and install](https://wiki.archlinux.org/index.php/Arch_User_Repository#Build_and_install_the_package) ``` -$ cd purple-skypeweb -$ makepkg -sri + cd purple-skypeweb + makepkg -sri ``` For more information about the Arch User Repository and how installs work, documentation can be found on the [ArchWiki AUR Page](https://wiki.archlinux.org/index.php/AUR) +Adium +----- +The magical [tripplet](https://github.com/tripplet) (who ported the [Steam prpl to Adium](https://github.com/tripplet/Adium-Steam-IM)) has ported [SkypeWeb to Adium](https://github.com/tripplet/skypeweb4adium) too. Releases for this are at https://github.com/tripplet/skypeweb4adium/releases + Contact me ---------- Files old/skype4pidgin-1.1/skypeweb/libjson-glib-1.0.dll and new/skype4pidgin-1.2.1/skypeweb/libjson-glib-1.0.dll differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/libskypeweb.c new/skype4pidgin-1.2.1/skypeweb/libskypeweb.c --- old/skype4pidgin-1.1/skypeweb/libskypeweb.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/libskypeweb.c 2016-08-08 09:32:12.000000000 +0200 @@ -320,12 +320,17 @@ sa->sent_messages_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); sa->waiting_conns = g_queue_new(); sa->messages_host = g_strdup(SKYPEWEB_DEFAULT_MESSAGES_HOST); + sa->url_datas = NULL; - if(strchr(purple_account_get_username(account), '@')) { - //Has an email address for a username, probably a microsoft account? - skypeweb_begin_oauth_login(sa); + if (purple_account_get_string(account, "refresh-token", NULL)) { + skypeweb_refresh_token_login(sa); } else { - skypeweb_begin_web_login(sa); + if (strchr(purple_account_get_username(account), '@')) { + //Has an email address for a username, probably a microsoft account? + skypeweb_begin_oauth_login(sa); + } else { + skypeweb_begin_web_login(sa); + } } purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", pc, PURPLE_CALLBACK(skypeweb_mark_conv_seen), NULL); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/libskypeweb.h new/skype4pidgin-1.2.1/skypeweb/libskypeweb.h --- old/skype4pidgin-1.1/skypeweb/libskypeweb.h 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/libskypeweb.h 2016-08-08 09:32:12.000000000 +0200 @@ -56,6 +56,17 @@ #include <json-glib/json-glib.h> +#define json_object_get_int_member(JSON_OBJECT, MEMBER) \ + (JSON_OBJECT && json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_int_member(JSON_OBJECT, MEMBER) : 0) +#define json_object_get_string_member(JSON_OBJECT, MEMBER) \ + (JSON_OBJECT && json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_string_member(JSON_OBJECT, MEMBER) : NULL) +#define json_object_get_array_member(JSON_OBJECT, MEMBER) \ + (JSON_OBJECT && json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_array_member(JSON_OBJECT, MEMBER) : NULL) +#define json_object_get_object_member(JSON_OBJECT, MEMBER) \ + (JSON_OBJECT && json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_object_member(JSON_OBJECT, MEMBER) : NULL) +#define json_object_get_boolean_member(JSON_OBJECT, MEMBER) \ + (JSON_OBJECT && json_object_has_member(JSON_OBJECT, MEMBER) ? json_object_get_boolean_member(JSON_OBJECT, MEMBER) : FALSE) + #ifndef PURPLE_PLUGINS # define PURPLE_PLUGINS #endif @@ -239,7 +250,7 @@ #define SKYPEWEB_MAX_MSG_RETRY 2 #define SKYPEWEB_PLUGIN_ID "prpl-skypeweb" -#define SKYPEWEB_PLUGIN_VERSION "1.1" +#define SKYPEWEB_PLUGIN_VERSION "1.2.1" #define SKYPEWEB_LOCKANDKEY_APPID "[email protected]" #define SKYPEWEB_LOCKANDKEY_SECRET "Q1P7W2E4J9R8U3S5" @@ -250,11 +261,13 @@ #define SKYPEWEB_LOGIN_HOST "login.skype.com" #define SKYPEWEB_VIDEOMAIL_HOST "vm.skype.com" #define SKYPEWEB_XFER_HOST "api.asm.skype.com" +#define SKYPEWEB_GRAPH_HOST "skypegraph.skype.com" #define SKYPEWEB_CLIENTINFO_NAME "swx-skype.com" -#define SKYPEWEB_CLIENTINFO_VERSION "908/1.22.117" +#define SKYPEWEB_CLIENTINFO_VERSION "908/1.50.53" #define SKYPEWEB_BUDDY_IS_MSN(a) G_UNLIKELY((a) != NULL && strchr((a), '@') != NULL) +#define SKYPEWEB_BUDDY_IS_PHONE(a) G_UNLIKELY((a) != NULL && *(a) == '+') typedef struct _SkypeWebAccount SkypeWebAccount; typedef struct _SkypeWebBuddy SkypeWebBuddy; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/pidgin-skypeweb.nsi new/skype4pidgin-1.2.1/skypeweb/pidgin-skypeweb.nsi --- old/skype4pidgin-1.1/skypeweb/pidgin-skypeweb.nsi 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/pidgin-skypeweb.nsi 2016-08-08 09:32:12.000000000 +0200 @@ -5,12 +5,19 @@ ; todo: SetBrandingImage ; HM NIS Edit Wizard helper defines +!ifndef PRODUCT_NAME !define PRODUCT_NAME "pidgin-skypeweb" -!define PRODUCT_VERSION "v1.1" +!endif +!ifndef PRODUCT_VERSION +!define PRODUCT_VERSION "v1.2.1" +!endif !define PRODUCT_PUBLISHER "Eion Robb" !define PRODUCT_WEB_SITE "http://eion.robbmob.com/" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" +!ifndef JSON_GLIB_DLL +!define JSON_GLIB_DLL "libjson-glib-1.0.dll" +!endif ; MUI 1.67 compatible ------ !include "MUI.nsh" @@ -59,11 +66,13 @@ ;Check for pidgin installation Call GetPidginInstPath - SetOverwrite try + SetOverwrite off SetOutPath "$PidginDir" File "${JSON_GLIB_DLL}" + SetOverwrite try + SetOutPath "$PidginDir\pixmaps\pidgin" File "/oname=protocols\16\skype.png" "icons\16\skype.png" File "/oname=protocols\22\skype.png" "icons\22\skype.png" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/purple-skypeweb.spec new/skype4pidgin-1.2.1/skypeweb/purple-skypeweb.spec --- old/skype4pidgin-1.1/skypeweb/purple-skypeweb.spec 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/purple-skypeweb.spec 2016-08-08 09:32:12.000000000 +0200 @@ -5,7 +5,7 @@ Release: 2%{?dist} License: GPLv3 URL: https://github.com/EionRobb/skype4pidgin -Source0: https://github.com/EionRobb/skype4pidgin/archive/v%{version}.tar.gz#/skype4pidgin-%{version}.tar.gz +Source0: https://github.com/EionRobb/skype4pidgin/archive/%{version}.tar.gz Summary: Adds support for Skype to Pidgin BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(purple) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_connection.c new/skype4pidgin-1.2.1/skypeweb/skypeweb_connection.c --- old/skype4pidgin-1.1/skypeweb/skypeweb_connection.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_connection.c 2016-08-08 09:32:12.000000000 +0200 @@ -582,7 +582,7 @@ } else { g_string_append_printf(request, "Content-Type: application/x-www-form-urlencoded\r\n"); } - g_string_append_printf(request, "Content-length: %zu\r\n", strlen(postdata)); + g_string_append_printf(request, "Content-length: %" G_GSIZE_FORMAT "\r\n", strlen(postdata)); } if (g_str_equal(host, SKYPEWEB_CONTACTS_HOST) || g_str_equal(host, SKYPEWEB_VIDEOMAIL_HOST) || g_str_equal(host, SKYPEWEB_NEW_CONTACTS_HOST)) { @@ -592,6 +592,9 @@ g_string_append(request, "Origin: https://web.skype.com\r\n"); g_string_append(request, "Referer: https://web.skype.com/main\r\n"); g_string_append(request, "Accept: application/json; ver=1.0;\r\n"); + } else if (g_str_equal(host, SKYPEWEB_GRAPH_HOST)) { + g_string_append_printf(request, "X-Skypetoken: %s\r\n", sa->skype_token); + g_string_append(request, "Accept: application/json\r\n"); } else if (g_str_equal(host, sa->messages_host)) { g_string_append_printf(request, "RegistrationToken: %s\r\n", sa->registration_token); g_string_append(request, "Referer: https://web.skype.com/main\r\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_connection.h new/skype4pidgin-1.2.1/skypeweb/skypeweb_connection.h --- old/skype4pidgin-1.1/skypeweb/skypeweb_connection.h 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_connection.h 2016-08-08 09:32:12.000000000 +0200 @@ -69,46 +69,4 @@ gchar *skypeweb_cookies_to_string(SkypeWebAccount *sa); - -/* Hack needed to stop redirect */ -struct _PurpleUtilFetchUrlData -{ - PurpleUtilFetchUrlCallback callback; - void *user_data; - - struct - { - char *user; - char *passwd; - char *address; - int port; - char *page; - - } website; - - char *url; - int num_times_redirected; - gboolean full; - char *user_agent; - gboolean http11; - char *request; - gsize request_written; - gboolean include_headers; - - gboolean is_ssl; - PurpleSslConnection *ssl_connection; - PurpleProxyConnectData *connect_data; - int fd; - guint inpa; - - gboolean got_headers; - gboolean has_explicit_data_len; - char *webdata; - gsize len; - unsigned long data_len; - gssize max_len; - gboolean chunked; - PurpleAccount *account; -}; - #endif /* SKYPEWEB_CONNECTION_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_contacts.c new/skype4pidgin-1.2.1/skypeweb/skypeweb_contacts.c --- old/skype4pidgin-1.1/skypeweb/skypeweb_contacts.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_contacts.c 2016-08-08 09:32:12.000000000 +0200 @@ -56,15 +56,20 @@ PurpleBuddy *buddy = user_data; SkypeWebBuddy *sbuddy = purple_buddy_get_protocol_data(buddy); SkypeWebAccount *sa = sbuddy->sa; + gchar *url = g_dataset_get_data(url_data, "url"); sa->url_datas = g_slist_remove(sa->url_datas, url_data); active_icon_downloads--; - if (!buddy) + if (!buddy) { + g_dataset_destroy(url_data); return; + } + + purple_buddy_icons_set_for_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), g_memdup(url_text, len), len, url); - purple_buddy_icons_set_for_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), g_memdup(url_text, len), len, url_data->url); + g_dataset_destroy(url_data); } static void @@ -72,6 +77,7 @@ { SkypeWebBuddy *sbuddy; gchar *url; + gpointer url_data; purple_debug_info("skypeweb", "getting new buddy icon for %s\n", purple_buddy_get_name(buddy)); @@ -82,9 +88,8 @@ url = g_strdup_printf("https://api.skype.com/users/%s/profile/avatar", purple_url_encode(purple_buddy_get_name(buddy))); } - skypeweb_fetch_url_request(sbuddy->sa, url, TRUE, NULL, FALSE, NULL, FALSE, 524288, skypeweb_get_icon_cb, buddy); - - g_free(url); + url_data = skypeweb_fetch_url_request(sbuddy->sa, url, TRUE, NULL, FALSE, NULL, FALSE, 524288, skypeweb_get_icon_cb, buddy); + g_dataset_set_data_full(url_data, "url", url, g_free); active_icon_downloads++; } @@ -119,6 +124,7 @@ SkypeWebAccount *sa; gint icon_id; gchar *msg_tmp; + gchar *location; // Conversation could have been closed before we retrieved the image if (!purple_conversation_is_valid(conv)) { @@ -129,13 +135,10 @@ sa = purple_connection_get_protocol_data(pc); sa->url_datas = g_slist_remove(sa->url_datas, url_data); - if (url_text == NULL && url_data->data_len) { - gchar *location; - location = skypeweb_string_get_chunk(url_data->webdata, url_data->data_len, "Location: https://", "/"); - if (location && *location) { - skypeweb_download_uri_to_conv(sa, location, conv); - g_free(location); - } + location = skypeweb_string_get_chunk(url_text, len, "Location: https://", "/"); + if (location && *location) { + skypeweb_download_uri_to_conv(sa, location, conv); + g_free(location); return; } @@ -157,8 +160,8 @@ void skypeweb_download_uri_to_conv(SkypeWebAccount *sa, const gchar *uri, PurpleConversation *conv) { - gchar *headers; - PurpleUtilFetchUrlData *requestdata; + gchar *headers, *url, *text; + gpointer requestdata; PurpleHttpURL *httpurl; httpurl = purple_http_url_parse(uri); @@ -173,11 +176,14 @@ requestdata = skypeweb_fetch_url_request(sa, uri, TRUE, NULL, FALSE, headers, FALSE, -1, skypeweb_got_imagemessage, conv); - if (requestdata != NULL) - requestdata->num_times_redirected = 10; /* Prevent following redirects */ + skypeweb_url_prevent_follow_redirects(requestdata); g_free(headers); purple_http_url_free(httpurl); + + url = purple_strreplace(uri, "imgt1", "imgpsh_fullsize"); + text = g_strdup_printf("<a href=\"%s\">Click here to view full version</a>", url); + purple_conversation_write(conv, conv->name, text, PURPLE_MESSAGE_SYSTEM, time(NULL)); } @@ -518,7 +524,7 @@ "Connection: close\r\n" "Authorization: skype_token %s\r\n" //slightly different to normal! "Host: " SKYPEWEB_XFER_HOST "\r\n" - "Content-Length: %d\r\n" + "Content-Length: %" G_GSIZE_FORMAT "\r\n" "Content-Type: application/json\r\n" "\r\n", purple_url_encode(swft->id), @@ -602,7 +608,7 @@ xmlnode_insert_data(anchor, temp, -1); g_free(temp); xmlnode_set_attrib(originalname, "v", purple_xfer_get_filename(xfer)); - temp = g_strdup_printf("%d", purple_xfer_get_size(xfer)); + temp = g_strdup_printf("%" G_GSIZE_FORMAT, purple_xfer_get_size(xfer)); xmlnode_set_attrib(filesize, "v", temp); g_free(temp); @@ -742,11 +748,7 @@ json_object_set_string_member(obj, "type", "sharing/file"); json_object_set_string_member(obj, "filename", basename); - if (SKYPEWEB_BUDDY_IS_MSN(swft->from)) { - id = g_strconcat("1:", swft->from, NULL); - } else { - id = g_strconcat("8:", swft->from, NULL); - } + id = g_strconcat(skypeweb_user_url_prefix(swft->from), swft->from, NULL); json_array_add_string_element(userpermissions, "read"); json_object_set_array_member(permissions, id, userpermissions); json_object_set_object_member(obj, "permissions", permissions); @@ -759,7 +761,7 @@ "Connection: close\r\n" "Authorization: skype_token %s\r\n" //slightly different to normal! "Host: " SKYPEWEB_XFER_HOST "\r\n" - "Content-Length: %d\r\n" + "Content-Length: %" G_GSIZE_FORMAT "\r\n" "Content-Type: application/json\r\n" "\r\n%s", sa->skype_token, @@ -832,6 +834,7 @@ username = json_object_get_string_member(userobj, "username"); g_free(sa->username); sa->username = g_strdup(username); + purple_connection_set_display_name(sa->pc, sa->username); old_alias = purple_account_get_private_alias(sa->account); if (!old_alias || !*old_alias) { @@ -876,15 +879,16 @@ void skypeweb_search_users_text_cb(SkypeWebAccount *sa, JsonNode *node, gpointer user_data) { + JsonObject *response = NULL; JsonArray *resultsarray = NULL; gint index, length; - GString *userids; gchar *search_term = user_data; PurpleNotifySearchResults *results; PurpleNotifySearchColumn *column; - resultsarray = json_node_get_array(node); + response = json_node_get_object(node); + resultsarray = json_object_get_array_member(response, "results"); length = json_array_get_length(resultsarray); if (length == 0) @@ -896,16 +900,6 @@ return; } - userids = g_string_new(""); - - resultsarray = json_node_get_array(node); - for(index = 0; index < length; index++) - { - JsonObject *result = json_array_get_object_element(resultsarray, index); - g_string_append_printf(userids, "%s,", json_object_get_string_member(result, "skypewebid")); - } - - results = purple_notify_searchresults_new(); if (results == NULL) { @@ -929,39 +923,42 @@ for(index = 0; index < length; index++) { - JsonObject *contact = json_array_get_object_element(resultsarray, index); - JsonObject *contactcards = json_object_get_object_member(contact, "ContactCards"); - JsonObject *skypecontact = json_object_get_object_member(contactcards, "Skype"); - JsonObject *currentlocation = json_object_get_object_member(contactcards, "CurrentLocation"); + JsonObject *result = json_array_get_object_element(resultsarray, index); + JsonObject *skypecontact = json_object_get_object_member(result, "nodeProfileData"); /* the row in the search results table */ /* prepend to it backwards then reverse to speed up adds */ GList *row = NULL; - - row = g_list_prepend(row, g_strdup(json_object_get_string_member(skypecontact, "SkypeName"))); - row = g_list_prepend(row, g_strdup(json_object_get_string_member(skypecontact, "DisplayName"))); - row = g_list_prepend(row, g_strdup(json_object_get_string_member(currentlocation, "City"))); - row = g_list_prepend(row, g_strdup(json_object_get_string_member(currentlocation, "Country"))); + +#define add_skypecontact_row(value) (\ + row = g_list_prepend(row, \ + !json_object_has_member(skypecontact, (value)) ? NULL : \ + g_strdup(json_object_get_string_member(skypecontact, (value)))\ + ) \ +) + add_skypecontact_row("skypeId"); + add_skypecontact_row("name"); + add_skypecontact_row("city"); + add_skypecontact_row("country"); row = g_list_reverse(row); purple_notify_searchresults_row_add(results, row); } - purple_notify_searchresults(sa->pc, NULL, search_term, NULL, - results, NULL, NULL); + purple_notify_searchresults(sa->pc, NULL, search_term, NULL, results, NULL, NULL); } void skypeweb_search_users_text(gpointer user_data, const gchar *text) { SkypeWebAccount *sa = user_data; - GString *url = g_string_new("/search/users/any?"); + GString *url = g_string_new("/search/v1.1/namesearch/swx/?"); - g_string_append_printf(url, "keyWord=%s&", purple_url_encode(text)); - g_string_append(url, "contactTypes[]=skype&"); + g_string_append_printf(url, "searchstring=%s&", purple_url_encode(text)); + g_string_append(url, "requestId=1&"); - skypeweb_post_or_get(sa, SKYPEWEB_METHOD_GET | SKYPEWEB_METHOD_SSL, SKYPEWEB_CONTACTS_HOST, url->str, NULL, skypeweb_search_users_text_cb, g_strdup(text), FALSE); + skypeweb_post_or_get(sa, SKYPEWEB_METHOD_GET | SKYPEWEB_METHOD_SSL, SKYPEWEB_GRAPH_HOST, url->str, NULL, skypeweb_search_users_text_cb, g_strdup(text), FALSE); g_string_free(url, TRUE); } @@ -1188,6 +1185,7 @@ gboolean authorized = json_object_get_boolean_member(contact, "authorized"); gboolean blocked = json_object_get_boolean_member(contact, "blocked"); const gchar *type = json_object_get_string_member(contact, "type"); + const gchar *mood = json_object_get_string_member(contact, "mood"); JsonObject *name = json_object_get_object_member(contact, "name"); const gchar *firstname = json_object_get_string_member(name, "first"); @@ -1233,6 +1231,7 @@ sbuddy->authorized = authorized; sbuddy->blocked = blocked; sbuddy->avatar_url = g_strdup(purple_buddy_icons_get_checksum_for_user(buddy)); + sbuddy->mood = g_strdup(mood); sbuddy->buddy = buddy; purple_buddy_set_protocol_data(buddy, sbuddy); @@ -1433,3 +1432,25 @@ g_free(url); } + + +void +skypeweb_set_mood_message(SkypeWebAccount *sa, const gchar *mood) +{ + JsonObject *obj, *payload; + gchar *post; + + g_return_if_fail(mood); + + obj = json_object_new(); + payload = json_object_new(); + + json_object_set_string_member(payload, "mood", mood); + json_object_set_object_member(obj, "payload", payload); + post = skypeweb_jsonobj_to_string(obj); + + skypeweb_post_or_get(sa, SKYPEWEB_METHOD_POST | SKYPEWEB_METHOD_SSL, SKYPEWEB_CONTACTS_HOST, "/users/self/profile/partial", post, NULL, NULL, TRUE); + + g_free(post); + json_object_unref(obj); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_contacts.h new/skype4pidgin-1.2.1/skypeweb/skypeweb_contacts.h --- old/skype4pidgin-1.1/skypeweb/skypeweb_contacts.h 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_contacts.h 2016-08-08 09:32:12.000000000 +0200 @@ -47,4 +47,6 @@ gboolean skypeweb_check_authrequests(SkypeWebAccount *sa); +void skypeweb_set_mood_message(SkypeWebAccount *sa, const gchar *mood); + #endif /* SKYPEWEB_CONTACTS_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_login.c new/skype4pidgin-1.2.1/skypeweb/skypeweb_login.c --- old/skype4pidgin-1.1/skypeweb/skypeweb_login.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_login.c 2016-08-08 09:32:12.000000000 +0200 @@ -27,16 +27,12 @@ SkypeWebAccount *sa = user_data; sa->url_datas = g_slist_remove(sa->url_datas, url_data); - - if (url_text == NULL) { - url_text = url_data->webdata; - len = url_data->data_len; - } if (url_text != NULL) refresh_token = skypeweb_string_get_chunk(url_text, len, "=\"skypetoken\" value=\"", "\""); if (refresh_token == NULL) { + purple_account_set_string(sa->account, "refresh-token", NULL); if (g_strstr_len(url_text, len, "recaptcha_response_field")) { purple_connection_error(sa->pc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, @@ -54,6 +50,7 @@ sa->skype_token = refresh_token; skypeweb_update_cookies(sa, url_text); + purple_account_set_string(sa->account, "refresh-token", g_hash_table_lookup(sa->cookie_table, "refresh-token")); skypeweb_do_all_the_things(sa); } @@ -115,8 +112,8 @@ "BehaviorOverride: redirectAs404\r\n" "Host: " SKYPEWEB_LOGIN_HOST "\r\n" "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%s", - strlen(postdata->str), postdata->str); + "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%.*s\0", + postdata->len, postdata->len, postdata->str); skypeweb_fetch_url_request(sa, login_url, TRUE, NULL, FALSE, request, TRUE, 524288, skypeweb_login_did_auth, sa); @@ -154,6 +151,27 @@ // <input type="hidden" name="t" id="t" value="..."> magic_t_value = skypeweb_string_get_chunk(url_text, len, "=\"t\" value=\"", "\""); if (!magic_t_value) { + //No Magic T???? Maybe it be the mighty 2fa-beast + + if (FALSE) + /*if (g_strnstr(url_text, len, "Set-Cookie: LOpt=0;"))*/ { + //XX - Would this be better retrieved with JSON decoding the "var ServerData = {...}" code? + // <script type="text/javascript">var ServerData = {...};</script> + gchar *session_state = skypeweb_string_get_chunk(url_text, len, ":'https://login.live.com/GetSessionState.srf?", "',"); + if (session_state) { + //These two appear to have different object keys each request :( + gchar *PPFT = skypeweb_string_get_chunk(url_text, len, ",sFT:'", "',"); + gchar *SLK = skypeweb_string_get_chunk(url_text, len, ",aB:'", "',"); + gchar *ppauth_cookie = skypeweb_string_get_chunk(url_text, len, "Set-Cookie: PPAuth=", ";"); + gchar *mspok_cookie = skypeweb_string_get_chunk(url_text, len, "Set-Cookie: MSPOK=", "; domain="); + + //Poll https://login.live.com/GetSessionState.srv?{session_state} to retrieve GIF(!!) of 2fa status + //1x1 size GIF means pending, 2x2 rejected, 1x2 approved + //Then re-request the MagicT, if approved with a slightly different GET parameters + //purpose=eOTT_OneTimePassword&PPFT={ppft}&login={email}&SLK={slk} + return; + } + } purple_connection_error(sa->pc, PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, _("Failed getting Magic T value")); return; } @@ -161,6 +179,7 @@ // postdata: t=...&oauthPartner=999&client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com postdata = g_string_new(""); g_string_append_printf(postdata, "t=%s&", purple_url_encode(magic_t_value)); + g_string_append(postdata, "site_name=lw.skype.com&"); g_string_append(postdata, "oauthPartner=999&"); g_string_append(postdata, "client_id=578134&"); g_string_append(postdata, "redirect_uri=https%3A%2F%2Fweb.skype.com"); @@ -172,8 +191,8 @@ "BehaviorOverride: redirectAs404\r\n" "Host: " SKYPEWEB_LOGIN_HOST "\r\n" "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%s", - strlen(postdata->str), postdata->str); + "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%.*s\0", + postdata->len, postdata->len, postdata->str); skypeweb_fetch_url_request(sa, login_url, TRUE, NULL, FALSE, request, TRUE, 524288, skypeweb_login_did_auth, sa); @@ -226,14 +245,14 @@ // POST to https://login.live.com/ppsecure/post.srf?wa=wsignin1.0&wreply=https%3A%2F%2Fsecure.skype.com%2Flogin%2Foauth%2Fproxy%3Fclient_id%3D578134%26redirect_uri%3Dhttps%253A%252F%252Fweb.skype.com - request = g_strdup_printf("POST /ppsecure/post.srf?wa=wsignin1.0&wp=MBI_SSL&wreply=https%%3A%%2F%%2Fsecure.skype.com%%2Flogin%%2Foauth%%2Fproxy%%3Fclient_id%%3D578134%%26redirect_uri%%3Dhttps%%253A%%252F%%252Fweb.skype.com HTTP/1.0\r\n" + request = g_strdup_printf("POST /ppsecure/post.srf?wa=wsignin1.0&wp=MBI_SSL&wreply=https%%3A%%2F%%2Flw.skype.com%%2Flogin%%2Foauth%%2Fproxy%%3Fclient_id%%3D578134%%26redirect_uri%%3Dhttps%%253A%%252F%%252Fweb.skype.com%%252F%%26site_name%%3Dlw.skype.com HTTP/1.0\r\n" "Connection: close\r\n" "Accept: */*\r\n" "Host: login.live.com\r\n" "Content-Type: application/x-www-form-urlencoded; charset=UTF-8\r\n" "Cookie: MSPRequ=%s;MSPOK=%s;CkTst=%s;\r\n" - "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%s", - msprequ_cookie, mspok_cookie, cktst_cookie, strlen(postdata->str), postdata->str); + "Content-Length: %" G_GSIZE_FORMAT "\r\n\r\n%.*s\0", + msprequ_cookie, mspok_cookie, cktst_cookie, postdata->len, postdata->len, postdata->str); skypeweb_fetch_url_request(sa, live_login_url, TRUE, NULL, FALSE, request, FALSE, 524288, skypeweb_login_got_t, sa); @@ -264,3 +283,27 @@ { skypeweb_post_or_get(sa, SKYPEWEB_METHOD_GET | SKYPEWEB_METHOD_SSL, SKYPEWEB_LOGIN_HOST, "/logout", NULL, NULL, NULL, TRUE); } + + + +void +skypeweb_refresh_token_login(SkypeWebAccount *sa) +{ + PurpleAccount *account = sa->account; + const gchar *login_url = "https://" SKYPEWEB_LOGIN_HOST;// "/login?client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com"; + gchar *request; + + request = g_strdup_printf("GET /login?client_id=578134&redirect_uri=https%%3A%%2F%%2Fweb.skype.com HTTP/1.0\r\n" + "Connection: close\r\n" + "Accept: */*\r\n" + "BehaviorOverride: redirectAs404\r\n" + "Host: " SKYPEWEB_LOGIN_HOST "\r\n" + "Cookie: refresh-token=%s\r\n\r\n", + purple_account_get_string(account, "refresh-token", "")); + + skypeweb_fetch_url_request(sa, login_url, TRUE, NULL, FALSE, request, TRUE, 524288, skypeweb_login_did_auth, sa); + + g_free(request); + + purple_connection_update_progress(sa->pc, _("Authenticating"), 2, 4); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_login.h new/skype4pidgin-1.2.1/skypeweb/skypeweb_login.h --- old/skype4pidgin-1.1/skypeweb/skypeweb_login.h 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_login.h 2016-08-08 09:32:12.000000000 +0200 @@ -27,5 +27,6 @@ void skypeweb_logout(SkypeWebAccount *sa); void skypeweb_begin_web_login(SkypeWebAccount *sa); void skypeweb_begin_oauth_login(SkypeWebAccount *sa); +void skypeweb_refresh_token_login(SkypeWebAccount *sa); #endif /* SKYPEWEB_LOGIN_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_messages.c new/skype4pidgin-1.2.1/skypeweb/skypeweb_messages.c --- old/skype4pidgin-1.1/skypeweb/skypeweb_messages.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_messages.c 2016-08-08 09:32:12.000000000 +0200 @@ -20,6 +20,7 @@ #include "skypeweb_util.h" #include "skypeweb_connection.h" #include "skypeweb_contacts.h" +#include "skypeweb_login.h" static gboolean skypeweb_is_user_self(SkypeWebAccount *sa, const gchar *username) { @@ -320,11 +321,7 @@ // This is a One-to-one/IM message convbuddyname = g_strdup(skypeweb_contact_url_to_name(conversationLink)); - if (SKYPEWEB_BUDDY_IS_MSN(convbuddyname)) { - convname = g_strconcat("1:", convbuddyname, NULL); - } else { - convname = g_strconcat("8:", convbuddyname, NULL); - } + convname = g_strconcat(skypeweb_user_url_prefix(convbuddyname), convbuddyname, NULL); from = skypeweb_contact_url_to_name(from); g_return_if_fail(from); @@ -638,6 +635,9 @@ // Dammit, Jim; I'm a programmer, not a surgeon! skypeweb_get_registration_token(sa); return; + } else if (errorCode == 450) { + // "Subscription requested could not be found." + // No more Womens Weekly? :O } } @@ -670,11 +670,7 @@ if (PURPLE_IS_IM_CONVERSATION(conv)) { const gchar *buddyname = purple_conversation_get_name(conv); - if (SKYPEWEB_BUDDY_IS_MSN(buddyname)) { - convname = g_strconcat("1:", buddyname, NULL); - } else { - convname = g_strconcat("8:", buddyname, NULL); - } + convname = g_strconcat(skypeweb_user_url_prefix(buddyname), buddyname, NULL); } else { convname = g_strdup(purple_conversation_get_data(conv, "chatname")); } @@ -907,11 +903,7 @@ const gchar *contacts_url = "/v1/users/ME/contacts"; gchar *url; - if (SKYPEWEB_BUDDY_IS_MSN(who)) { - url = g_strconcat(contacts_url, "/1:", purple_url_encode(who), NULL); - } else { - url = g_strconcat(contacts_url, "/8:", purple_url_encode(who), NULL); - } + url = g_strconcat(contacts_url, "/", skypeweb_user_url_prefix(who), purple_url_encode(who), NULL); skypeweb_post_or_get(sa, SKYPEWEB_METHOD_DELETE | SKYPEWEB_METHOD_SSL, sa->messages_host, url, NULL, NULL, NULL, TRUE); @@ -938,11 +930,7 @@ JsonObject *contact = json_object_new(); gchar *id; - if (SKYPEWEB_BUDDY_IS_MSN(cur->data)) { - id = g_strconcat("1:", cur->data, NULL); - } else { - id = g_strconcat("8:", cur->data, NULL); - } + id = g_strconcat(skypeweb_user_url_prefix(cur->data), cur->data, NULL); json_object_set_string_member(contact, "id", id); json_array_add_object_element(contacts_array, contact); @@ -1018,11 +1006,6 @@ sa->url_datas = g_slist_remove(sa->url_datas, url_data); if (url_text == NULL) { - url_text = url_data->webdata; - len = url_data->data_len; - } - - if (url_text == NULL) { if (purple_major_version == 2 && ( purple_minor_version < 10 || (purple_minor_version == 10 && purple_micro_version < 11)) @@ -1052,9 +1035,13 @@ expires = skypeweb_string_get_chunk(url_text, len, "expires=", ";"); if (registration_token == NULL) { - purple_connection_error (sa->pc, - PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED, - _("Failed getting Registration Token")); + if (purple_account_get_string(sa->account, "refresh-token", NULL)) { + skypeweb_refresh_token_login(sa); + } else { + purple_connection_error (sa->pc, + PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + _("Failed getting Registration Token")); + } return; } //purple_debug_info("skypeweb", "New RegistrationToken is %s\n", registration_token); @@ -1076,7 +1063,7 @@ gchar *request; gchar *curtime; gchar *response; - PurpleUtilFetchUrlData *requestdata; + gpointer requestdata; g_free(sa->registration_token); sa->registration_token = NULL; g_free(sa->endpoint); sa->endpoint = NULL; @@ -1102,8 +1089,7 @@ requestdata = skypeweb_fetch_url_request(sa, messages_url, TRUE, NULL, FALSE, request, TRUE, 524288, skypeweb_got_registration_token, sa); - if (requestdata != NULL) - requestdata->num_times_redirected = 10; /* Prevent following redirects */ + skypeweb_url_prevent_follow_redirects(requestdata); g_free(request); g_free(curtime); @@ -1122,11 +1108,7 @@ gchar *post, *url; JsonObject *obj; - if (SKYPEWEB_BUDDY_IS_MSN(name)) { - url = g_strdup_printf("/v1/users/ME/conversations/1:%s/messages", purple_url_encode(name)); - } else { - url = g_strdup_printf("/v1/users/ME/conversations/8:%s/messages", purple_url_encode(name)); - } + url = g_strdup_printf("/v1/users/ME/conversations/%s%s/messages", skypeweb_user_url_prefix(name), purple_url_encode(name)); obj = json_object_new(); json_object_set_int_member(obj, "clientmessageid", time(NULL)); @@ -1172,6 +1154,7 @@ SkypeWebAccount *sa = purple_connection_get_protocol_data(pc); skypeweb_set_statusid(sa, purple_status_get_id(status)); + skypeweb_set_mood_message(sa, purple_status_get_attr_string(status, "message")); } void @@ -1261,11 +1244,7 @@ SkypeWebAccount *sa = purple_connection_get_protocol_data(pc); gchar *convname; - if (SKYPEWEB_BUDDY_IS_MSN(who)) { - convname = g_strconcat("1:", who, NULL); - } else { - convname = g_strconcat("8:", who, NULL); - } + convname = g_strconcat(skypeweb_user_url_prefix(who), who, NULL); skypeweb_send_message(sa, convname, message); g_free(convname); @@ -1288,11 +1267,7 @@ url = g_string_new("/v1/threads/"); g_string_append_printf(url, "%s", purple_url_encode(chatname)); g_string_append(url, "/members/"); - if (SKYPEWEB_BUDDY_IS_MSN(who)) { - g_string_append_printf(url, "1:%s", purple_url_encode(who)); - } else { - g_string_append_printf(url, "8:%s", purple_url_encode(who)); - } + g_string_append_printf(url, "%s%s", skypeweb_user_url_prefix(who), purple_url_encode(who)); post = "{\"role\":\"User\"}"; @@ -1316,11 +1291,7 @@ url = g_string_new("/v1/threads/"); g_string_append_printf(url, "%s", purple_url_encode(chatname)); g_string_append(url, "/members/"); - if (SKYPEWEB_BUDDY_IS_MSN(who)) { - g_string_append_printf(url, "1:%s", purple_url_encode(who)); - } else { - g_string_append_printf(url, "8:%s", purple_url_encode(who)); - } + g_string_append_printf(url, "%s%s", skypeweb_user_url_prefix(who), purple_url_encode(who)); post = ""; @@ -1340,11 +1311,7 @@ members = json_array_new(); contact = json_object_new(); - if (SKYPEWEB_BUDDY_IS_MSN(who)) { - id = g_strconcat("1:", who, NULL); - } else { - id = g_strconcat("8:", who, NULL); - } + id = g_strconcat(skypeweb_user_url_prefix(who), who, NULL); json_object_set_string_member(contact, "id", id); json_object_set_string_member(contact, "role", "User"); json_array_add_object_element(members, contact); @@ -1420,4 +1387,4 @@ //{"baseDomain":"https://join.skype.com/launch/","threadId":"%s"} // {"Id":"MeMxigEAAAAxOTo5NDZkMjExMGQ4YmU0ZjQzODc3NjMxNDQ3ZTgxYWNmNkB0aHJlYWQuc2t5cGU","Blob":null,"JoinUrl":"https://join.skype.com/ALXsHZ2RFQnk","ThreadId":"19:[email protected]"} -} \ No newline at end of file +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_util.c new/skype4pidgin-1.2.1/skypeweb/skypeweb_util.c --- old/skype4pidgin-1.1/skypeweb/skypeweb_util.c 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_util.c 2016-08-08 09:32:12.000000000 +0200 @@ -81,6 +81,7 @@ start = g_strrstr(url, "/8:"); if (!start) start = g_strrstr(url, "/1:"); + if (!start) start = g_strrstr(url, "/4:"); if (!start) return NULL; start = start + 3; @@ -215,11 +216,15 @@ gint64 skypeweb_get_js_time() { +#if GLIB_CHECK_VERSION(2, 28, 0) + return (g_get_real_time() / 1000); +#else GTimeVal val; g_get_current_time (&val); return (((gint64) val.tv_sec) * 1000) + (val.tv_usec / 1000); +#endif } /* copied from oscar.c to be libpurple 2.1 compatible */ @@ -249,6 +254,112 @@ } +/* Hack needed to stop redirect */ +struct _PurpleUtilFetchUrlData +{ + PurpleUtilFetchUrlCallback callback; + void *user_data; + + struct + { + char *user; + char *passwd; + char *address; + int port; + char *page; + + } website; + + char *url; + int num_times_redirected; + gboolean full; + char *user_agent; + gboolean http11; + char *request; + gsize request_written; + gboolean include_headers; + + gboolean is_ssl; + PurpleSslConnection *ssl_connection; + PurpleProxyConnectData *connect_data; + int fd; + guint inpa; + + gboolean got_headers; + gboolean has_explicit_data_len; + char *webdata; + gsize len; + unsigned long data_len; + gssize max_len; + gboolean chunked; + PurpleAccount *account; +}; + +/* Hack needed to stop redirect */ +struct _PurpleUtilFetchUrlDataTwoEleven +{ + PurpleUtilFetchUrlCallback callback; + void *user_data; + + struct + { + char *user; + char *passwd; + char *address; + int port; + char *page; + + } website; + + char *url; + int num_times_redirected; + gboolean full; + char *user_agent; + gboolean http11; + char *request; + gsize request_len; + gsize request_written; + gboolean include_headers; + + gboolean is_ssl; + PurpleSslConnection *ssl_connection; + PurpleProxyConnectData *connect_data; + int fd; + guint inpa; + + gboolean got_headers; + gboolean has_explicit_data_len; + char *webdata; + gsize len; + unsigned long data_len; + gssize max_len; + gboolean chunked; + PurpleAccount *account; +}; + +static void +skypeweb_fetch_url_request_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message) { + + PurpleUtilFetchUrlCallback callback; + + if (url_text == NULL) { + if (purple_major_version == 2 && purple_minor_version >= 11) { + struct _PurpleUtilFetchUrlDataTwoEleven *two_eleven_url_data = (struct _PurpleUtilFetchUrlDataTwoEleven *) url_data; + + url_text = two_eleven_url_data->webdata; + len = two_eleven_url_data->data_len; + } else { + url_text = url_data->webdata; + len = url_data->data_len; + } + } + + callback = g_dataset_get_data(url_data, "real_callback"); + callback(url_data, user_data, url_text, len, error_message); + + g_dataset_destroy(url_data); +} + /* Wrapper of purple_util_fetch_url_request_len_with_account() * that takes a SkypeWebAccount instead of a PurpleAccount, * and keeps track of requests in sa->url_datas to cancel them on logout. */ @@ -261,10 +372,31 @@ { PurpleUtilFetchUrlData *url_data; - url_data = purple_util_fetch_url_request(sa->account, url, full, user_agent, http11, request, include_headers, max_len, callback, user_data); + url_data = purple_util_fetch_url_request(sa->account, url, full, user_agent, http11, request, include_headers, max_len, skypeweb_fetch_url_request_cb, user_data); + g_dataset_set_data(url_data, "real_callback", callback); if (url_data != NULL) sa->url_datas = g_slist_prepend(sa->url_datas, url_data); return url_data; } + +void +skypeweb_url_prevent_follow_redirects(PurpleUtilFetchUrlData *requestdata) +{ + if (requestdata != NULL) { + requestdata->num_times_redirected = 10; + } +} + +const gchar * +skypeweb_user_url_prefix(const gchar *who) +{ + if (SKYPEWEB_BUDDY_IS_MSN(who)) { + return "1:"; + } else if(SKYPEWEB_BUDDY_IS_PHONE(who)) { + return "4:"; + } else { + return "8:"; + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/skype4pidgin-1.1/skypeweb/skypeweb_util.h new/skype4pidgin-1.2.1/skypeweb/skypeweb_util.h --- old/skype4pidgin-1.1/skypeweb/skypeweb_util.h 2016-01-07 02:40:08.000000000 +0100 +++ new/skype4pidgin-1.2.1/skypeweb/skypeweb_util.h 2016-08-08 09:32:12.000000000 +0200 @@ -36,3 +36,7 @@ const char *url, gboolean full, const char *user_agent, gboolean http11, const char *request, gboolean include_headers, gssize max_len, PurpleUtilFetchUrlCallback callback, void *user_data); + +void skypeweb_url_prevent_follow_redirects(PurpleUtilFetchUrlData *requestdata); + +const gchar *skypeweb_user_url_prefix(const gchar *who);
