[Pkg-privacy-commits] [irssi-plugin-otr] 169/267: Fix: comments and fct naming in otr.c
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:41:39 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.
commit 2846da2349f0a4ff3f3a74afac87b0ae7d45faab
Author: David Goulet <dgoulet at ev0ke.net>
Date: Sat Dec 1 23:57:51 2012 -0500
Fix: comments and fct naming in otr.c
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
src/module.c | 7 ++-----
src/otr.c | 39 ++++++++++++++++++++++++++++++++-------
src/otr.h | 4 ++--
3 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/src/module.c b/src/module.c
index 81926b6..fba7a4b 100644
--- a/src/module.c
+++ b/src/module.c
@@ -308,10 +308,7 @@ void otr_init(void)
otr_lib_init();
- /*
- * Username does not really matter here since well... we got only one :).
- */
- user_state_global = otr_init_user("one to rule them all");
+ user_state_global = otr_init_user_state();
if (!user_state_global) {
IRSSI_MSG("Unable to allocate user global state");
return;
@@ -354,7 +351,7 @@ void otr_deinit(void)
otr_finishall(user_state_global);
- otr_free_user(user_state_global);
+ otr_free_user_state(user_state_global);
otr_lib_uninit();
diff --git a/src/otr.c b/src/otr.c
index d9b2e8e..858f07d 100644
--- a/src/otr.c
+++ b/src/otr.c
@@ -45,6 +45,12 @@ static const char *statusbar_txt[] = {
"CTX_UPDATE"
};
+/*
+ * Allocate and return a string containing the account name of the Irssi server
+ * record.
+ *
+ * Return: nick at myserver.net
+ */
static char *create_account_name(SERVER_REC *irssi)
{
int ret;
@@ -100,6 +106,9 @@ error_filename:
return;
}
+/*
+ * Free otr peer context. Callback passed to libotr.
+ */
static void destroy_peer_context_cb(void *data)
{
struct otr_peer_context *opc = data;
@@ -111,6 +120,9 @@ static void destroy_peer_context_cb(void *data)
IRSSI_DEBUG("Peer context freed");
}
+/*
+ * Allocate otr peer context. Callback passed to libotr.
+ */
static void add_peer_context_cb(void *data, ConnContext *context)
{
struct otr_peer_context *opc;
@@ -128,6 +140,9 @@ static void add_peer_context_cb(void *data, ConnContext *context)
IRSSI_DEBUG("Peer context created for %s", context->username);
}
+/*
+ * Find Irssi server record by account name.
+ */
static SERVER_REC *find_irssi_by_account_name(const char *accname)
{
GSList *tmp;
@@ -198,7 +213,7 @@ static int check_fp_encrypted_msgstate(Fingerprint *fp)
}
}
- /* No state is in an encrypted state. */
+ /* No state is encrypted. */
ret = 0;
end:
@@ -206,7 +221,7 @@ end:
}
/*
- * Get a context from a pair.
+ * Find context from nickname and irssi server record.
*/
ConnContext *otr_find_context(SERVER_REC *irssi, const char *nick, int create)
{
@@ -231,6 +246,9 @@ error:
return ctx;
}
+/*
+ * Create otr peer context.
+ */
struct otr_peer_context *otr_create_peer_context(void)
{
struct otr_peer_context *opc;
@@ -239,14 +257,12 @@ struct otr_peer_context *otr_create_peer_context(void)
}
/*
- * Return a newly allocated OTR user state for the given username.
+ * Return a newly allocated OTR user state.
*/
-struct otr_user_state *otr_init_user(const char *user)
+struct otr_user_state *otr_init_user_state(void)
{
struct otr_user_state *ous = NULL;
- assert(user);
-
ous = zmalloc(sizeof(*ous));
if (!ous) {
goto error;
@@ -264,7 +280,10 @@ error:
return ous;
}
-void otr_free_user(struct otr_user_state *ustate)
+/*
+ * Destroy otr user state.
+ */
+void otr_free_user_state(struct otr_user_state *ustate)
{
if (ustate->otr_state) {
otrl_userstate_free(ustate->otr_state);
@@ -332,6 +351,9 @@ error:
return -1;
}
+/*
+ * List otr contexts to the main Irssi windows.
+ */
void otr_contexts(struct otr_user_state *ustate)
{
char human_fp[OTRL_PRIVKEY_FPRINT_HUMAN_LEN], *trust;
@@ -452,6 +474,9 @@ end:
return;
}
+/*
+ * Finish all otr contexts.
+ */
void otr_finishall(struct otr_user_state *ustate)
{
ConnContext *context;
diff --git a/src/otr.h b/src/otr.h
index e205ba2..afe7cc0 100644
--- a/src/otr.h
+++ b/src/otr.h
@@ -113,8 +113,8 @@ void otr_status_change(SERVER_REC *irssi, const char *nick,
/* init stuff */
-struct otr_user_state *otr_init_user(const char *user);
-void otr_free_user(struct otr_user_state *ustate);
+struct otr_user_state *otr_init_user_state(void);
+void otr_free_user_state(struct otr_user_state *ustate);
void otr_lib_init();
void otr_lib_uninit();
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git
More information about the Pkg-privacy-commits
mailing list