--- a/libpurple/protocols/zephyr/zephyr.c Wed Jan 13 04:35:22 2021 -0600
+++ b/libpurple/protocols/zephyr/zephyr.c Wed Jan 13 04:35:43 2021 -0600
@@ -106,18 +106,6 @@
-#define z_call(func) if (func != ZERR_NONE)\
-#define z_call_r(func) if (func != ZERR_NONE)\
-#define z_call_s(func, err) if (func != ZERR_NONE) {\
- purple_connection_error(\
- purple_account_get_connection(zephyr->account),\
- PURPLE_CONNECTION_ERROR_NETWORK_ERROR, err);\
extern const char *username;
@@ -849,7 +837,9 @@
/* XXX add real error reporting */
- z_call_r(ZReceiveNotice(¬ice, NULL));
+ if (ZReceiveNotice(¬ice, NULL) != ZERR_NONE) { @@ -1402,10 +1392,26 @@
login_zeph02(zephyr_account *zephyr)
- /* XXX z_call_s should actually try to report the com_err determined error */
- z_call_s(ZInitialize(), "Couldn't initialize zephyr");
- z_call_s(ZOpenPort(&(zephyr->port)), "Couldn't open port");
- z_call_s(ZSetLocation(zephyr->exposure), "Couldn't set location");
+ PurpleConnection *pc = purple_account_get_connection(zephyr->account); + /* XXX Should actually try to report the com_err determined error */ + if (ZInitialize() != ZERR_NONE) { + purple_connection_error(pc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + "Couldn't initialize zephyr"); + if (ZOpenPort(&(zephyr->port)) != ZERR_NONE) { + purple_connection_error(pc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + if (ZSetLocation(zephyr->exposure) != ZERR_NONE) { + purple_connection_error(pc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, + "Couldn't set location"); zephyr->username = g_strdup(ZGetSender());
zephyr->realm = get_zephyr_realm(zephyr->account, ZGetRealm());
@@ -1596,9 +1602,15 @@
g_source_remove(zephyr->loctimer);
if (use_zeph02(zephyr)) {
- z_call(ZCancelSubscriptions(0));
- z_call(ZUnsetLocation());
+ if (ZCancelSubscriptions(0) != ZERR_NONE) { + if (ZUnsetLocation() != ZERR_NONE) { + if (ZClosePort() != ZERR_NONE) {