# HG changeset patch # User Mikael Berthe # Date 1268584603 -3600 # Node ID 573a48de8ee1505faf59ee3a7ec83a31e6de1372 # Parent 14f4f6dcc75adc796f3673bc4d1e8c9f9289964c Update lastmsg module to API dev:6 diff -r 14f4f6dcc75a -r 573a48de8ee1 lastmsg/lastmsg.c --- a/lastmsg/lastmsg.c Sun Mar 14 16:59:12 2010 +0100 +++ b/lastmsg/lastmsg.c Sun Mar 14 17:36:43 2010 +0100 @@ -8,8 +8,6 @@ you are away (or not available) if they contain your nickname. When you're back, you can display them in the status window with the /lastmsg command. - Note that this module is dumb: if your nick is foo and somebody - says "foobar" the message will be stored! This module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,7 +26,6 @@ #include #include #include -#include #include static void lastmsg_init(void); @@ -38,7 +35,7 @@ module_info_t info_lastmsg = { .branch = MCABBER_BRANCH, .api = MCABBER_API_VERSION, - .version = "0.01", + .version = "0.02", .description = "Add a command /lastmsg", .requires = NULL, .init = lastmsg_init, @@ -78,7 +75,7 @@ { enum imstatus status; const gchar *bjid, *res, *msg; - gboolean muc = FALSE; + gboolean muc = FALSE, urgent = FALSE; status = xmpp_getstatus(); @@ -98,23 +95,14 @@ else if (!g_strcmp0(args->name, "groupchat")) { if (!g_strcmp0(args->value, "true")) muc = TRUE; + } else if (!g_strcmp0(args->name, "urgent")) { + if (!g_strcmp0(args->value, "true")) + urgent = TRUE; } } - if (muc && bjid && res && msg) { - GSList *room_elt; + if (muc && urgent && bjid && res && msg) { struct lastm_T *lastm_item; - const gchar *mynick = NULL; - - room_elt = roster_find(bjid, jidsearch, ROSTER_TYPE_ROOM); - if (room_elt) - mynick = buddy_getnickname(room_elt->data); - - if (!mynick || !g_strcmp0(res, mynick)) - return; - - if (!g_strstr_len(msg, -1, mynick)) - return; lastm_item = g_new(struct lastm_T, 1); lastm_item->mucname = g_strdup(bjid); @@ -155,7 +143,7 @@ hk_add_handler(last_status_hh, HOOK_MY_STATUS_CHANGE, NULL); } -/* Deinitialization */ +/* Uninitialization */ static void lastmsg_uninit(void) { /* Unregister command */