~ubuntu-branches/ubuntu/oneiric/irssi/oneiric

« back to all changes in this revision

Viewing changes to src/fe-common/irc/fe-events-numeric.c

  • Committer: Bazaar Package Importer
  • Author(s): Andres Rodriguez
  • Date: 2009-05-05 15:50:50 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090505155050-aoqlnpes7che9rtd
Tags: 0.8.13-1ubuntu1
* Merge from debian unstable (LP: #372411), remaining changes:
  - debian/patches: 03firsttimer_text
    + Adapt it so it tells you about connecting to irc.ubuntu.com and
      joining #ubuntu instead of irc.debian.org and #debian.
  - debian/patches: 90irc-ubuntu-com
* Fixed debian/patches/90irc-ubuntu-com for new irssi.conf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "misc.h"
25
25
#include "settings.h"
26
26
#include "levels.h"
 
27
#include "recode.h"
27
28
 
28
29
#include "irc-servers.h"
29
30
#include "irc-channels.h"
105
106
static void event_who(IRC_SERVER_REC *server, const char *data)
106
107
{
107
108
        char *params, *nick, *channel, *user, *host, *stat, *realname, *hops;
108
 
        char *serv;
 
109
        char *serv, *recoded;
109
110
 
110
111
        g_return_if_fail(data != NULL);
111
112
 
118
119
        if (*realname == ' ')
119
120
                *realname++ = '\0';
120
121
        
 
122
        recoded = recode_in(SERVER(server), realname, nick);
121
123
        printformat(server, NULL, MSGLEVEL_CRAP, IRCTXT_WHO,
122
 
                    channel, nick, stat, hops, user, host, realname, serv);
 
124
                    channel, nick, stat, hops, user, host, recoded, serv);
123
125
 
124
126
        g_free(params);
 
127
        g_free(recoded);
125
128
}
126
129
 
127
130
static void event_end_of_who(IRC_SERVER_REC *server, const char *data)
210
213
static void event_invite_list(IRC_SERVER_REC *server, const char *data)
211
214
{
212
215
        const char *channel;
213
 
        char *params, *invite;
 
216
        char *params, *invite, *setby, *tims;
 
217
        long secs;
214
218
 
215
219
        g_return_if_fail(data != NULL);
216
220
 
217
 
        params = event_get_params(data, 3, NULL, &channel, &invite);
 
221
        params = event_get_params(data, 5, NULL, &channel, &invite,
 
222
                        &setby, &tims);
 
223
        secs = *tims == '\0' ? 0 :
 
224
                (long) (time(NULL) - atol(tims));
 
225
 
218
226
        channel = get_visible_target(server, channel);
219
227
        printformat(server, channel, MSGLEVEL_CRAP,
220
 
                    IRCTXT_INVITELIST, channel, invite);
 
228
                    *setby == '\0' ? IRCTXT_INVITELIST : IRCTXT_INVITELIST_LONG,
 
229
                    channel, invite, setby, secs);
221
230
        g_free(params);
222
231
}
223
232
 
239
248
static void event_topic_get(IRC_SERVER_REC *server, const char *data)
240
249
{
241
250
        const char *channel;
242
 
        char *params, *topic;
 
251
        char *params, *topic, *recoded;
243
252
 
244
253
        g_return_if_fail(data != NULL);
245
254
 
246
255
        params = event_get_params(data, 3, NULL, &channel, &topic);
 
256
        recoded = recode_in(SERVER(server), topic, channel);
247
257
        channel = get_visible_target(server, channel);
248
258
        printformat(server, channel, MSGLEVEL_CRAP,
249
 
                    IRCTXT_TOPIC, channel, topic);
 
259
                    IRCTXT_TOPIC, channel, recoded);
250
260
        g_free(params);
 
261
        g_free(recoded);
251
262
}
252
263
 
253
264
static void event_topic_info(IRC_SERVER_REC *server, const char *data)
317
328
 
318
329
static void event_away(IRC_SERVER_REC *server, const char *data)
319
330
{
320
 
        char *params, *nick, *awaymsg;
 
331
        char *params, *nick, *awaymsg, *recoded;
321
332
 
322
333
        g_return_if_fail(data != NULL);
323
334
 
324
335
        params = event_get_params(data, 3, NULL, &nick, &awaymsg);
 
336
        recoded = recode_in(SERVER(server), awaymsg, nick);
325
337
        if (!settings_get_bool("show_away_once") ||
326
338
            last_away_nick == NULL || g_strcasecmp(last_away_nick, nick) != 0 ||
327
339
            last_away_msg == NULL || g_strcasecmp(last_away_msg, awaymsg) != 0) {
333
345
                last_away_msg = g_strdup(awaymsg);
334
346
 
335
347
                printformat(server, nick, MSGLEVEL_CRAP,
336
 
                            IRCTXT_NICK_AWAY, nick, awaymsg);
 
348
                            IRCTXT_NICK_AWAY, nick, recoded);
337
349
        }
338
350
        g_free(params);
 
351
        g_free(recoded);
339
352
}
340
353
 
341
354
static void event_userhost(IRC_SERVER_REC *server, const char *data)
448
461
        cannot_join(server, data, IRCTXT_JOINERROR_TOOMANY);
449
462
}
450
463
 
451
 
static void event_duplicate_channel(IRC_SERVER_REC *server, const char *data)
 
464
static void event_duplicate_channel(IRC_SERVER_REC *server, const char *data,
 
465
                const char *nick)
452
466
{
453
467
        char *params, *channel, *p;
454
468
 
463
477
        if (channel[0] == '!' && channel[1] == '!') {
464
478
                printformat(server, NULL, MSGLEVEL_CRAP,
465
479
                            IRCTXT_JOINERROR_DUPLICATE, channel+1);
466
 
        }
 
480
        } else
 
481
                print_event_received(server, data, nick, FALSE);
467
482
 
468
483
        g_free(params);
469
484
}
535
550
static void print_event_received(IRC_SERVER_REC *server, const char *data,
536
551
                                 const char *nick, int target_param)
537
552
{
538
 
        char *target, *args, *ptr, *ptr2;
 
553
        char *target, *args, *ptr, *ptr2, *recoded;
539
554
        int format;
540
555
 
541
556
        g_return_if_fail(data != NULL);
564
579
                        g_memmove(ptr+1, ptr+2, strlen(ptr+1));
565
580
        }
566
581
 
 
582
        recoded = recode_in(SERVER(server), args, NULL);
567
583
        format = nick == NULL || server->real_address == NULL ||
568
584
                strcmp(nick, server->real_address) == 0 ?
569
585
                IRCTXT_DEFAULT_EVENT : IRCTXT_DEFAULT_EVENT_SERVER;
570
586
        printformat(server, target, MSGLEVEL_CRAP, format,
571
 
                    nick, args, current_server_event);
 
587
                    nick, recoded, current_server_event);
572
588
 
 
589
        g_free(recoded);
573
590
        g_free(args);
574
591
        g_free(target);
575
592
}