ticket147.patch

David Paleino, 01/03/2009 10:32 AM

Download (5.7 KB)

 
b/src/Engine-IRC/Protocols/Irc/IrcProtocolManager.cs
485 485
                            CommandPing(command);
486 486
                            handled = true;
487 487
                            break;
488
                        case "version":
489
                            CommandVersion(command);
490
                            handled = true;
491
                            break;
492
                        case "time":
493
                            CommandTime(command);
494
                            handled = true;
495
                            break;
488 496
                        case "who":
489 497
                            CommandWho(command);
490 498
                            handled = true;
......
655 663
            "whois nick",
656 664
            "whowas nick",
657 665
            "ping nick",
666
            "version nick",
667
            "time nick",
658 668
            "mode new-mode",
659 669
            "away [away-message]",
660 670
            "kick nick(s) [reason]",
......
1008 1018
            }
1009 1019
        }
1010 1020
        
1021
        public void CommandVersion(CommandModel cd)
1022
        {
1023
            if (cd.DataArray.Length >= 2) {
1024
                string destination = cd.DataArray[1];
1025
                Session.AddTextToChat(_NetworkChat, "[ctcp(" + destination + ")] VERSION");
1026
                _IrcClient.SendMessage(SendType.CtcpRequest, destination, "VERSION");
1027
            } else {
1028
                _NotEnoughParameters(cd);
1029
            }
1030
        }
1031

  
1032
        public void CommandTime(CommandModel cd)
1033
        {
1034
            if (cd.DataArray.Length >= 2) {
1035
                string destination = cd.DataArray[1];
1036
                Session.AddTextToChat(_NetworkChat, "[ctcp(" + destination + ")] TIME");
1037
                _IrcClient.SendMessage(SendType.CtcpRequest, destination, "TIME");
1038
            } else {
1039
                _NotEnoughParameters(cd);
1040
            }
1041
        }
1042

  
1011 1043
        public void CommandWho(CommandModel cd)
1012 1044
        {
1013 1045
            if (cd.DataArray.Length < 2) {
b/src/Frontend-GNOME-IRC/IrcGroupChatView.cs
93 93
                Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
94 94
                whois_item.Activated += _OnUserListMenuWhoisActivated;
95 95
                PersonMenu.Append(whois_item);
96

  
97
                Gtk.ImageMenuItem ctcp_item = new Gtk.ImageMenuItem(_("CTCP"));
98
                Gtk.Menu ctcp_submenu = new Gtk.Menu();
99
                Gtk.ImageMenuItem ctcp_version_item = new Gtk.ImageMenuItem(_("Version"));
100
                ctcp_version_item.Activated += _OnUserListMenuCTCPVersionActivated;
101
                ctcp_submenu.Append(ctcp_version_item);
102

  
103
                Gtk.ImageMenuItem ctcp_ping_item = new Gtk.ImageMenuItem(_("Ping"));
104
                ctcp_ping_item.Activated += _OnUserListMenuCTCPPingActivated;
105
                ctcp_submenu.Append(ctcp_ping_item);
106

  
107
                Gtk.ImageMenuItem ctcp_time_item = new Gtk.ImageMenuItem(_("Time"));
108
                ctcp_time_item.Activated += _OnUserListMenuCTCPTimeActivated;
109
                ctcp_submenu.Append(ctcp_time_item);
110

  
111
                ctcp_item.Submenu = ctcp_submenu;
112
                PersonMenu.Append(ctcp_item);
96 113
            }
97 114
            
98 115
            if (PersonTreeView != null) {
......
360 377
            }
361 378
        }
362 379
        
380
        private void _OnUserListMenuCTCPVersionActivated(object sender, EventArgs e)
381
        {
382
            Trace.Call(sender, e);
383

  
384
            IList<PersonModel> persons = GetSelectedPersons();
385
            if (persons == null) {
386
                return;
387
            }
388

  
389
            foreach (PersonModel person in persons) {
390
                _IrcProtocolManager.CommandVersion(
391
                    new CommandModel(
392
                        Frontend.FrontendManager,
393
                        ChatModel,
394
                        person.ID
395
                    )
396
                );
397
            }
398
        }
399

  
400
        private void _OnUserListMenuCTCPPingActivated(object sender, EventArgs e)
401
        {
402
            Trace.Call(sender, e);
403

  
404
            IList<PersonModel> persons = GetSelectedPersons();
405
            if (persons == null) {
406
                return;
407
            }
408

  
409
            foreach (PersonModel person in persons) {
410
                _IrcProtocolManager.CommandPing(
411
                    new CommandModel(
412
                        Frontend.FrontendManager,
413
                        ChatModel,
414
                        person.ID
415
                    )
416
                );
417
            }
418
        }
419

  
420
        private void _OnUserListMenuCTCPTimeActivated(object sender, EventArgs e)
421
        {
422
            Trace.Call(sender, e);
423

  
424
            IList<PersonModel> persons = GetSelectedPersons();
425
            if (persons == null) {
426
                return;
427
            }
428

  
429
            foreach (PersonModel person in persons) {
430
                _IrcProtocolManager.CommandTime(
431
                    new CommandModel(
432
                        Frontend.FrontendManager,
433
                        ChatModel,
434
                        person.ID
435
                    )
436
                );
437
            }
438
        }
439

  
363 440
        protected override void OnPersonsRowActivated(object sender, Gtk.RowActivatedArgs e)
364 441
        {
365 442
            Trace.Call(sender, e);