X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=ircd%2Fm_away.c;h=ef440c19ab37a54009864dd76bdbbcf0cc5c897c;hb=1570a04e15bec6b2945e4351b1e05211aecdcacc;hp=a321f9bb21078513cf65f8e33bfdd47214d5bf6b;hpb=cc05a230ac079fa15a2e43e6e68ef7126128cefd;p=ircu2.10.12-pk.git diff --git a/ircd/m_away.c b/ircd/m_away.c index a321f9b..ef440c1 100644 --- a/ircd/m_away.c +++ b/ircd/m_away.c @@ -84,6 +84,7 @@ #include "client.h" #include "ircd.h" #include "ircd_alloc.h" +#include "ircd_log.h" #include "ircd_reply.h" #include "ircd_string.h" #include "msg.h" @@ -92,7 +93,7 @@ #include "s_user.h" #include "send.h" -#include +/* #include -- Now using assert in ircd_log.h */ #include /* @@ -129,9 +130,8 @@ static int user_set_away(struct User* user, char* message) len = AWAYLEN; } if (away) - away = (char*) MyRealloc(away, len + 1); - else - away = (char*) MyMalloc(len + 1); + MyFree(away); + away = (char*) MyMalloc(len + 1); assert(0 != away); user->away = away; @@ -142,7 +142,7 @@ static int user_set_away(struct User* user, char* message) /* - * m_away - generic message handler template + * m_away - generic message handler * - Added 14 Dec 1988 by jto. * * parv[0] = sender prefix @@ -154,12 +154,15 @@ static int user_set_away(struct User* user, char* message) int m_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { char* away_message = parv[1]; + int was_away = cli_user(sptr)->away != 0; assert(0 != cptr); assert(cptr == sptr); - if (user_set_away(cli_user(sptr), away_message)) { - sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); + if (user_set_away(cli_user(sptr), away_message)) + { + if (!was_away) + sendcmdto_serv_butone(sptr, CMD_AWAY, cptr, ":%s", away_message); send_reply(sptr, RPL_NOWAWAY); } else { @@ -170,7 +173,7 @@ int m_away(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) } /* - * ms_away - server message handler template + * ms_away - server message handler * - Added 14 Dec 1988 by jto. * * parv[0] = sender prefix