Skip to content

Commit

Permalink
Load is_work through FbData, fixes api key issues after the first login.
Browse files Browse the repository at this point in the history
I have no idea what request after login requires api keys, though.
This plugin signs all post-login requests pointlessly.
  • Loading branch information
dequis committed Oct 17, 2017
1 parent 24db488 commit 553593d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
17 changes: 17 additions & 0 deletions facebook/facebook-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ enum
PROP_TOKEN,
PROP_UID,
PROP_TWEAK,
PROP_WORK,

PROP_N
};
Expand Down Expand Up @@ -155,6 +156,9 @@ fb_api_set_property(GObject *obj, guint prop, const GValue *val,
priv->tweak = g_value_get_int(val);
fb_http_set_agent(priv->http, fb_api_get_agent_string(priv->tweak, 0));
break;
case PROP_WORK:
priv->is_work = g_value_get_boolean(val);
break;

default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop, pspec);
Expand Down Expand Up @@ -189,6 +193,9 @@ fb_api_get_property(GObject *obj, guint prop, GValue *val, GParamSpec *pspec)
case PROP_TWEAK:
g_value_set_int(val, priv->tweak);
break;
case PROP_WORK:
g_value_set_boolean(val, priv->is_work);
break;

default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop, pspec);
Expand Down Expand Up @@ -321,6 +328,16 @@ fb_api_class_init(FbApiClass *klass)
"",
0, G_MAXINT, 0,
G_PARAM_READWRITE);

/**
* FbApi:work:
*/
props[PROP_WORK] = g_param_spec_boolean(
"work",
"Work",
"",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_properties(gklass, PROP_N, props);

/**
Expand Down
8 changes: 8 additions & 0 deletions facebook/facebook-data.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ fb_data_load(FbData *fata)
g_value_unset(&val);
}

num = set_getbool(&acct->set, "work");
if (num != 0) {
g_value_init(&val, G_TYPE_BOOLEAN);
g_value_set_boolean(&val, num);
g_object_set_property(G_OBJECT(priv->api), "work", &val);
g_value_unset(&val);
}

fb_api_rehash(priv->api);
return ret;
}
Expand Down

0 comments on commit 553593d

Please sign in to comment.