mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 04:43:34 +02:00
Added my_asctime()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1114 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
d427f74143
commit
93ba91b8ed
6 changed files with 27 additions and 60 deletions
|
|
@ -296,20 +296,13 @@ static void event_topic_get(IRC_SERVER_REC *server, const char *data)
|
|||
static void event_topic_info(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *timestr, *channel, *topicby, *topictime;
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 4, NULL, &channel,
|
||||
&topicby, &topictime);
|
||||
|
||||
t = (time_t) atol(topictime);
|
||||
tm = localtime(&t);
|
||||
|
||||
timestr = g_strdup(asctime(tm));
|
||||
if (timestr[strlen(timestr)-1] == '\n')
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
timestr = my_asctime((time_t) atol(topictime));
|
||||
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_TOPIC_INFO, topicby, timestr);
|
||||
|
|
@ -332,20 +325,12 @@ static void event_channel_mode(IRC_SERVER_REC *server, const char *data)
|
|||
static void event_channel_created(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *channel, *createtime, *timestr;
|
||||
time_t t;
|
||||
struct tm *tm;
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
params = event_get_params(data, 3, NULL, &channel, &createtime);
|
||||
|
||||
t = (time_t) atol(createtime);
|
||||
tm = localtime(&t);
|
||||
|
||||
timestr = g_strdup(asctime(tm));
|
||||
if (timestr[strlen(timestr)-1] == '\n')
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
|
||||
timestr = my_asctime((time_t) atol(createtime));
|
||||
printformat(server, channel, MSGLEVEL_CRAP,
|
||||
IRCTXT_CHANNEL_CREATED, channel, timestr);
|
||||
g_free(timestr);
|
||||
|
|
@ -397,7 +382,7 @@ static void event_whois(IRC_SERVER_REC *server, const char *data)
|
|||
|
||||
static void event_whois_idle(IRC_SERVER_REC *server, const char *data)
|
||||
{
|
||||
char *params, *nick, *secstr, *signonstr, *rest;
|
||||
char *params, *nick, *secstr, *signonstr, *rest, *timestr;
|
||||
long days, hours, mins, secs;
|
||||
time_t signon;
|
||||
|
||||
|
|
@ -419,13 +404,7 @@ static void event_whois_idle(IRC_SERVER_REC *server, const char *data)
|
|||
printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE,
|
||||
nick, days, hours, mins, secs);
|
||||
else {
|
||||
char *timestr;
|
||||
struct tm *tim;
|
||||
|
||||
tim = localtime(&signon);
|
||||
timestr = g_strdup(asctime(tim));
|
||||
if (timestr[strlen(timestr)-1] == '\n')
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
timestr = my_asctime(signon);
|
||||
printformat(server, nick, MSGLEVEL_CRAP, IRCTXT_WHOIS_IDLE_SIGNON,
|
||||
nick, days, hours, mins, secs, timestr);
|
||||
g_free(timestr);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "module-formats.h"
|
||||
#include "signals.h"
|
||||
#include "commands.h"
|
||||
#include "misc.h"
|
||||
#include "special-vars.h"
|
||||
#include "settings.h"
|
||||
|
||||
|
|
@ -332,8 +333,7 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
{
|
||||
CHANNEL_REC *channel;
|
||||
char *timestr;
|
||||
struct tm *tm;
|
||||
|
||||
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
channel = *data != '\0' ? channel_find(server, data) : CHANNEL(item);
|
||||
|
|
@ -344,11 +344,7 @@ static void cmd_topic(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
|
|||
channel->name, channel->topic);
|
||||
|
||||
if (channel->topic_time > 0) {
|
||||
tm = localtime(&channel->topic_time);
|
||||
timestr = g_strdup(asctime(tm));
|
||||
if (timestr[strlen(timestr)-1] == '\n')
|
||||
timestr[strlen(timestr)-1] = '\0';
|
||||
|
||||
timestr = my_asctime(channel->topic_time);
|
||||
printformat(server, channel->name, MSGLEVEL_CRAP,
|
||||
IRCTXT_TOPIC_INFO, channel->topic_by, timestr);
|
||||
g_free(timestr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue