Compare commits

..

7 Commits

Author SHA1 Message Date
f7acc9cf82 Initial framework based off pidgin-icq 2021-04-10 20:27:58 +01:00
af7e951408 Add a makefile task to run a pidgin 2021-04-10 20:27:58 +01:00
3389ba8e81 Add some more code from pidgin-icq 2021-04-10 20:27:58 +01:00
13e90a691f purple: Allow protocol options to be configured 2021-04-10 20:27:58 +01:00
fcce5e9da0 purple: Add a way to specify the account has a password 2021-04-10 20:27:58 +01:00
c98d1920b4 purple: Add a way to access the account password 2021-04-10 20:27:58 +01:00
265e77da6a purple: Support libpurple 2.13
get_cb_alias was introduced in 2.14 and referencing it directly in this
macro breaks compilation against libpurple-2.13, as found in Debian
Buster.

https://docs.pidgin.im/pidgin/2.x.y/struct__PurplePluginProtocolInfo.html#ad43cef005f1634b0d170cc2972c69550
2021-04-10 20:27:56 +01:00
2 changed files with 29 additions and 19 deletions

View File

@@ -82,16 +82,17 @@ pub struct MsgInfo {
pub struct AccountData {
display_name: String,
imap_host: String,
imap_port: String,
imap_port: i32,
imap_user: String,
imap_pass: String,
smtp_host: String,
smtp_port: String,
smtp_port: i32,
smtp_user: String,
smtp_pass: String,
bcc_self: bool,
// Not exposed: server_flags, selfstatus, e2ee_enabled
session_closed: AtomicBool,
// session: RwLock<Option<icq::protocol::SessionInfo>>,
}
@@ -141,10 +142,18 @@ impl purple::PrplPlugin for PurpleDelta {
.with_info(info)
.with_password()
.with_string_option("Display Name".into(), "displayname".into(), "".into())
.with_string_option("IMAP server host".into(), "mail_server".into(), "".into())
.with_string_option(
"IMAP server hostname".into(),
"mail_server".into(),
"".into(),
)
.with_string_option("IMAP server port".into(), "mail_port".into(), "".into())
// Username and password are mail_user and mail_pw
.with_string_option("SMTP server host".into(), "send_server".into(), "".into())
.with_string_option(
"SMTP server hostname".into(),
"send_server".into(),
"".into(),
)
.with_string_option("SMTP server port".into(), "send_port".into(), "".into())
.with_string_option("SMTP server username".into(), "send_user".into(), "".into())
.with_password_option("SMTP server password".into(), "send_pw".into(), "".into())
@@ -152,14 +161,16 @@ impl purple::PrplPlugin for PurpleDelta {
.enable_login()
.enable_load()
.enable_close()
//.enable_chat_info()
//.enable_chat_info_defaults()
//.enable_join_chat()
//.enable_chat_leave()
//.enable_send_im()
//.enable_chat_send()
//.enable_convo_closed()
//.enable_get_chat_name()
/*
.enable_chat_info()
.enable_chat_info_defaults()
.enable_join_chat()
.enable_chat_leave()
.enable_send_im()
.enable_chat_send()
.enable_convo_closed()
.enable_get_chat_name()
*/
.enable_list_icon()
.enable_status_types()
}
@@ -170,12 +181,12 @@ impl purple::LoginHandler for PurpleDelta {
let display_name = account.get_string("displayname", "");
let imap_host = account.get_string("mail_server", "");
let imap_port = account.get_string("mail_port", "");
let imap_port = account.get_int("mail_port", 0);
let imap_user = account.get_username().unwrap().into();
let imap_pass = account.get_password().unwrap().into();
let smtp_host = account.get_string("send_server", "");
let smtp_port = account.get_string("send_port", "");
let smtp_port = account.get_int("send_port", 0);
let smtp_user = account.get_string("send_user", "");
let smtp_pass = account.get_string("send_pw", "");

View File

@@ -83,7 +83,7 @@ impl<P> RegisterContext<P> {
self
}
pub fn with_string_option(self, name: String, key: String, def: String) -> Self {
pub fn with_string_option(mut self, name: String, key: String, def: String) -> Self {
self.with_option(PrplOption {
text: name,
key: key,
@@ -92,7 +92,7 @@ impl<P> RegisterContext<P> {
})
}
pub fn with_password_option(self, name: String, key: String, def: String) -> Self {
pub fn with_password_option(mut self, name: String, key: String, def: String) -> Self {
self.with_option(PrplOption {
text: name,
key: key,
@@ -101,7 +101,7 @@ impl<P> RegisterContext<P> {
})
}
pub fn with_bool_option(self, name: String, key: String, def: bool) -> Self {
pub fn with_bool_option(mut self, name: String, key: String, def: bool) -> Self {
self.with_option(PrplOption {
text: name,
key: key,
@@ -223,8 +223,7 @@ impl_extra_handler_builder! {
impl<T: crate::purple::handlers::traits::GetChatBuddyAlias> RegisterContext<T> {
#[allow(dead_code)]
pub fn enable_get_cb_alias(mut self) -> Self {
self.extra_info.get_cb_alias =
Some(crate::purple::handlers::entrypoints::get_cb_alias::<T>);
self.extra_info.get_cb_alias = Some(crate::purple::handlers::entrypoints::get_cb_alias::<T>);
self
}
}