Skip to content

Commit 958ea90

Browse files
authored
Platform 8 update: Port FreshRSS plugin to Soup 3 (#32)
* Fix some errors for FreshRSS * Add return type to auth signal handler
1 parent 246b53f commit 958ea90

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

plugins/backend/fresh/freshConnection.vala

+12-12
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,27 @@ public class FeedReader.freshConnection {
2525
m_settingsTweaks = new GLib.Settings("com.github.suzie97.communique.tweaks");
2626
m_session = new Soup.Session();
2727
m_session.user_agent = Constants.USER_AGENT;
28-
m_session.authenticate.connect((msg, auth, retrying) => {
29-
if(m_utils.getHtaccessUser() == "")
30-
{
31-
Logger.error("fresh Session: need Authentication");
32-
}
33-
else if(!retrying)
34-
{
35-
auth.authenticate(m_utils.getHtaccessUser(), m_utils.getHtaccessPasswd());
36-
}
37-
});
3828
}
3929

4030
public LoginResponse getSID()
4131
{
4232
var message = new Soup.Message("POST", m_utils.getURL()+"accounts/ClientLogin");
4333

34+
message.authenticate.connect((auth, retrying) => {
35+
if(m_utils.getHtaccessUser() == "") {
36+
Logger.error("fresh Session: need Authentication");
37+
} else if(!retrying) {
38+
auth.authenticate(m_utils.getHtaccessUser(), m_utils.getHtaccessPasswd());
39+
return true;
40+
}
41+
return false;
42+
});
43+
4444
var msg = new freshMessage();
4545
msg.add("Email", m_utils.getUser());
4646
msg.add("Passwd", m_utils.getPasswd());
4747

48-
message.set_request("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, msg.get().data);
48+
message.set_request_body_from_bytes("application/x-www-form-urlencoded", new Bytes(msg.get().data));
4949
var response_body = m_session.send_and_read(message);
5050

5151
if(message.status_code != 200)
@@ -91,7 +91,7 @@ public class FeedReader.freshConnection {
9191
message.request_headers.append("Authorization","GoogleLogin auth=%s".printf(m_utils.getToken()));
9292
message.request_headers.append("Content-Type", type);
9393

94-
message.request_body.append_take(input.data);
94+
message.set_request_body_from_bytes(type, new Bytes(input.data));
9595
var response_body = m_session.send_and_read(message);
9696

9797
if(message.status_code != 200)

0 commit comments

Comments
 (0)