From b6646faf42c38fa053eb1397694c47857b2d4def Mon Sep 17 00:00:00 2001 From: Eion Robb Date: Wed, 3 Jan 2024 23:41:38 +1300 Subject: [PATCH] Add GitHub actions, clean up compiler warnings --- .github/workflows/cross.yml | 72 +++++++++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 27 ++++++++++++++ teams_contacts.c | 4 +-- teams_messages.c | 2 +- 4 files changed, 102 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/cross.yml create mode 100644 .github/workflows/linux.yml diff --git a/.github/workflows/cross.yml b/.github/workflows/cross.yml new file mode 100644 index 0000000..19f9d7d --- /dev/null +++ b/.github/workflows/cross.yml @@ -0,0 +1,72 @@ +name: Cross compile for Windows +on: + - push + - pull_request +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up MinGW + run: | + sudo apt update + sudo apt install -y gcc-mingw-w64-i686-win32 + + - name: Load Pidgin from cache + id: pidgin-cache + uses: actions/cache@v3 + with: + path: pidgin + key: pidgin-2.14.1 + + - name: Download Pidgin + if: steps.pidgin-cache.outputs.cache-hit != 'true' + run: | + curl --http1.1 -L https://sourceforge.net/projects/pidgin/files/Pidgin/2.14.1/pidgin-2.14.1.tar.bz2/download -o pidgin.tar.bz2 + tar -xf pidgin.tar.bz2 + mv pidgin-2.14.1 pidgin + curl --http1.1 -L https://sourceforge.net/projects/pidgin/files/Pidgin/2.14.1/pidgin-2.14.1-win32-bin.zip/download -o pidgin-win32bin.zip + unzip pidgin-win32bin.zip + cp pidgin-2.14.1-win32bin/libpurple.dll pidgin/libpurple/ + + - name: Load Win32 deps from cache + id: win32-cache + uses: actions/cache@v3 + with: + path: win32-dev + key: win32-dev + + - name: Setup WinPidgin build + if: steps.win32-cache.outputs.cache-hit != 'true' + run: | + mkdir win32-dev + curl --http1.1 -L http://ftp.gnome.org/pub/gnome/binaries/win32/glib/2.28/glib-dev_2.28.8-1_win32.zip -o glib-dev.zip + unzip glib-dev.zip -d win32-dev/glib-2.28.8 + curl --http1.1 -L http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/gettext-runtime-dev_0.18.1.1-2_win32.zip -o gettext-runtime.zip + unzip gettext-runtime.zip -d win32-dev/glib-2.28.8 + curl --http1.1 -L http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/zlib-dev_1.2.5-2_win32.zip -o zlib-dev.zip + unzip zlib-dev.zip -d win32-dev/glib-2.28.8 + + cd win32-dev + curl --http1.1 -L https://github.com/jgeboski/purple-facebook/releases/download/downloads/json-glib-0.14.tar.gz -o json-glib.tar.gz + tar -xf json-glib.tar.gz + rm json-glib.tar.gz + cd .. + + ls win32-dev/ + + - name: make + run: | + export WIN32_CC=i686-w64-mingw32-gcc + export WIN32_DEV_TOP=win32-dev + export PIDGIN_TREE_TOP=pidgin + make libteams.dll + + - name: archive + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v4 + with: + name: plugin + path: lib*.dll diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..83d40cc --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,27 @@ +name: Linux +on: + - push + - pull_request +jobs: + build: + name: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: install deps + run: | + sudo apt update + sudo apt install -y libglib2.0-dev libjson-glib-dev gettext + # We only need these to build, not to run. Skip the dependency check. + sudo apt download libpurple0 libpurple-dev + sudo dpkg --force-depends -i libpurple0*.deb libpurple-dev*.deb + - name: make + run: make + + - name: archive + if: ${{ !env.ACT }} + uses: actions/upload-artifact@v4 + with: + name: plugin + path: lib*.so diff --git a/teams_contacts.c b/teams_contacts.c index 80e4db6..6f1cf18 100644 --- a/teams_contacts.c +++ b/teams_contacts.c @@ -92,7 +92,7 @@ teams_get_icon_cb(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, return; } - purple_buddy_icons_set_for_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), g_memdup(data, len), len, url); + purple_buddy_icons_set_for_user(purple_buddy_get_account(buddy), purple_buddy_get_name(buddy), g_memdup2(data, len), len, url); } @@ -204,7 +204,7 @@ teams_got_imagemessage(PurpleHttpConnection *http_conn, PurpleHttpResponse *resp if (!purple_http_response_is_successful(response)) return; - image = purple_image_new_from_data(g_memdup(url_text, len), len); + image = purple_image_new_from_data(g_memdup2(url_text, len), len); icon_id = purple_image_store_add(image); msg_tmp = g_strdup_printf("", icon_id); diff --git a/teams_messages.c b/teams_messages.c index acb9c74..a59daff 100644 --- a/teams_messages.c +++ b/teams_messages.c @@ -350,7 +350,7 @@ process_message_resource(TeamsAccount *sa, JsonObject *resource) if (purple_strequal(purple_xmlnode_get_name(uriobject), "URIObject") && purple_strequal(uriobject_type, "SWIFT.1")) { PurpleXmlNode *swift = purple_xmlnode_get_child(uriobject, "Swift"); const gchar *swift_b64 = purple_xmlnode_get_attrib(swift, "b64"); - guint swift_b64_len; + gsize swift_b64_len; guchar *swift_data = purple_base64_decode(swift_b64, &swift_b64_len); from = teams_contact_url_to_name(from);