summaryrefslogtreecommitdiff
path: root/src/plugins/typing/typing-status.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/typing/typing-status.c')
-rw-r--r--src/plugins/typing/typing-status.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/plugins/typing/typing-status.c b/src/plugins/typing/typing-status.c
index 298b9d496..1d4d540b6 100644
--- a/src/plugins/typing/typing-status.c
+++ b/src/plugins/typing/typing-status.c
@@ -53,6 +53,9 @@ typing_status_search_state (const char *state)
{
int i;
+ if (!state)
+ return -1;
+
for (i = 0; i < TYPING_STATUS_NUM_STATES; i++)
{
if (strcmp (typing_status_state_string[i], state) == 0)
@@ -298,47 +301,47 @@ typing_status_nick_add (struct t_gui_buffer *buffer, const char *nick,
}
/*
- * Removes a nick typing status from a buffer.
+ * Searches a nick typing status for a buffer.
*
- * Returns:
- * 1: OK
- * 0: error
+ * Returns pointer to t_typing_status found, NULL if not found.
*/
-void
-typing_status_nick_remove (struct t_gui_buffer *buffer, const char *nick)
+struct t_typing_status *
+typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
{
struct t_hashtable *ptr_nicks;
- if (!typing_status_nicks)
- return;
+ if (!typing_status_nicks || !buffer || !nick)
+ return NULL;
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
if (!ptr_nicks)
- return;
+ return NULL;
- weechat_hashtable_remove (ptr_nicks, nick);
+ return weechat_hashtable_get (ptr_nicks, nick);
}
/*
- * Searches a nick typing status for a buffer.
+ * Removes a nick typing status from a buffer.
*
- * Returns pointer to t_typing_status found, NULL if not found.
+ * Returns:
+ * 1: OK
+ * 0: error
*/
-struct t_typing_status *
-typing_status_nick_search (struct t_gui_buffer *buffer, const char *nick)
+void
+typing_status_nick_remove (struct t_gui_buffer *buffer, const char *nick)
{
struct t_hashtable *ptr_nicks;
if (!typing_status_nicks)
- return NULL;
+ return;
ptr_nicks = weechat_hashtable_get (typing_status_nicks, buffer);
if (!ptr_nicks)
- return NULL;
+ return;
- return weechat_hashtable_get (ptr_nicks, nick);
+ weechat_hashtable_remove (ptr_nicks, nick);
}
/*