comparison lisp/erc/erc-backend.el @ 87687:aef7ff97a0c2

ERC: Sync changes from upstream.
author Michael Olson <mwolson@gnu.org>
date Thu, 10 Jan 2008 03:51:14 +0000
parents 107ccd98fa12
children b8f89dd3680d
comparison
equal deleted inserted replaced
87686:a7108d800053 87687:aef7ff97a0c2
1347 ?h (first (erc-response.command-args parsed)) ?i erc-server-lag 1347 ?h (first (erc-response.command-args parsed)) ?i erc-server-lag
1348 ?s (if (/= erc-server-lag 1) "s" ""))) 1348 ?s (if (/= erc-server-lag 1) "s" "")))
1349 (erc-update-mode-line)))) 1349 (erc-update-mode-line))))
1350 1350
1351 (define-erc-response-handler (PRIVMSG NOTICE) 1351 (define-erc-response-handler (PRIVMSG NOTICE)
1352 nil nil 1352 "Handle private messages, including messages in channels." nil
1353 (let ((sender-spec (erc-response.sender parsed)) 1353 (let ((sender-spec (erc-response.sender parsed))
1354 (cmd (erc-response.command parsed)) 1354 (cmd (erc-response.command parsed))
1355 (tgt (car (erc-response.command-args parsed))) 1355 (tgt (car (erc-response.command-args parsed)))
1356 (msg (erc-response.contents parsed))) 1356 (msg (erc-response.contents parsed)))
1357 (if (or (erc-ignored-user-p sender-spec) 1357 (if (or (erc-ignored-user-p sender-spec)
1411 ;; FIXME: need clean way of specifiying extra hooks in 1411 ;; FIXME: need clean way of specifiying extra hooks in
1412 ;; define-erc-response-handler. 1412 ;; define-erc-response-handler.
1413 (add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query) 1413 (add-hook 'erc-server-PRIVMSG-functions 'erc-auto-query)
1414 1414
1415 (define-erc-response-handler (QUIT) 1415 (define-erc-response-handler (QUIT)
1416 nil nil 1416 "Another user has quit IRC." nil
1417 (let ((reason (erc-response.contents parsed)) 1417 (let ((reason (erc-response.contents parsed))
1418 bufs) 1418 bufs)
1419 (multiple-value-bind (nick login host) 1419 (multiple-value-bind (nick login host)
1420 (erc-parse-user (erc-response.sender parsed)) 1420 (erc-parse-user (erc-response.sender parsed))
1421 (setq bufs (erc-buffer-list-with-nick nick proc)) 1421 (setq bufs (erc-buffer-list-with-nick nick proc))
1424 (erc-display-message parsed 'notice bufs 1424 (erc-display-message parsed 'notice bufs
1425 'QUIT ?n nick ?u login 1425 'QUIT ?n nick ?u login
1426 ?h host ?r reason)))) 1426 ?h host ?r reason))))
1427 1427
1428 (define-erc-response-handler (TOPIC) 1428 (define-erc-response-handler (TOPIC)
1429 nil nil 1429 "The channel topic has changed." nil
1430 (let* ((ch (first (erc-response.command-args parsed))) 1430 (let* ((ch (first (erc-response.command-args parsed)))
1431 (topic (erc-trim-string (erc-response.contents parsed))) 1431 (topic (erc-trim-string (erc-response.contents parsed)))
1432 (time (format-time-string "%T %m/%d/%y" (current-time)))) 1432 (time (format-time-string "%T %m/%d/%y" (current-time))))
1433 (multiple-value-bind (nick login host) 1433 (multiple-value-bind (nick login host)
1434 (erc-parse-user (erc-response.sender parsed)) 1434 (erc-parse-user (erc-response.sender parsed))
1437 (erc-display-message parsed 'notice (erc-get-buffer ch proc) 1437 (erc-display-message parsed 'notice (erc-get-buffer ch proc)
1438 'TOPIC ?n nick ?u login ?h host 1438 'TOPIC ?n nick ?u login ?h host
1439 ?c ch ?T topic)))) 1439 ?c ch ?T topic))))
1440 1440
1441 (define-erc-response-handler (WALLOPS) 1441 (define-erc-response-handler (WALLOPS)
1442 nil nil 1442 "Display a WALLOPS message." nil
1443 (let ((message (erc-response.contents parsed))) 1443 (let ((message (erc-response.contents parsed)))
1444 (multiple-value-bind (nick login host) 1444 (multiple-value-bind (nick login host)
1445 (erc-parse-user (erc-response.sender parsed)) 1445 (erc-parse-user (erc-response.sender parsed))
1446 (erc-display-message 1446 (erc-display-message
1447 parsed 'notice nil 1447 parsed 'notice nil
1463 (erc-display-message 1463 (erc-display-message
1464 parsed 'notice (if erc-server-connected 'active proc) 1464 parsed 'notice (if erc-server-connected 'active proc)
1465 (erc-response.contents parsed))) 1465 (erc-response.contents parsed)))
1466 1466
1467 (define-erc-response-handler (376 422) 1467 (define-erc-response-handler (376 422)
1468 nil nil 1468 "End of MOTD/MOTD is missing." nil
1469 (erc-server-MOTD proc parsed) 1469 (erc-server-MOTD proc parsed)
1470 (erc-connection-established proc parsed)) 1470 (erc-connection-established proc parsed))
1471 1471
1472 (define-erc-response-handler (004) 1472 (define-erc-response-handler (004)
1473 nil nil 1473 "Display the server's identification." nil
1474 (multiple-value-bind (server-name server-version) 1474 (multiple-value-bind (server-name server-version)
1475 (cdr (erc-response.command-args parsed)) 1475 (cdr (erc-response.command-args parsed))
1476 (setq erc-server-version server-version) 1476 (setq erc-server-version server-version)
1477 (setq erc-server-announced-name server-name) 1477 (setq erc-server-announced-name server-name)
1478 (erc-update-mode-line-buffer (process-buffer proc)) 1478 (erc-update-mode-line-buffer (process-buffer proc))
1508 . 1508 .
1509 ,(match-string 2 section)))))) 1509 ,(match-string 2 section))))))
1510 (erc-display-message parsed 'notice proc line))) 1510 (erc-display-message parsed 'notice proc line)))
1511 1511
1512 (define-erc-response-handler (221) 1512 (define-erc-response-handler (221)
1513 nil nil 1513 "Display the current user modes." nil
1514 (let* ((nick (first (erc-response.command-args parsed))) 1514 (let* ((nick (first (erc-response.command-args parsed)))
1515 (modes (mapconcat 'identity 1515 (modes (mapconcat 'identity
1516 (cdr (erc-response.command-args parsed)) " "))) 1516 (cdr (erc-response.command-args parsed)) " ")))
1517 (erc-set-modes nick modes) 1517 (erc-set-modes nick modes)
1518 (erc-display-message parsed 'notice 'active 's221 ?n nick ?m modes))) 1518 (erc-display-message parsed 'notice 'active 's221 ?n nick ?m modes)))
1594 (erc-display-message 1594 (erc-display-message
1595 parsed 'notice 'active catalog-entry 1595 parsed 'notice 'active catalog-entry
1596 ?n nick ?f fname ?u user ?h host)))) 1596 ?n nick ?f fname ?u user ?h host))))
1597 1597
1598 (define-erc-response-handler (312) 1598 (define-erc-response-handler (312)
1599 nil nil 1599 "Server name response in WHOIS." nil
1600 (multiple-value-bind (nick server-host) 1600 (multiple-value-bind (nick server-host)
1601 (cdr (erc-response.command-args parsed)) 1601 (cdr (erc-response.command-args parsed))
1602 (erc-display-message 1602 (erc-display-message
1603 parsed 'notice 'active 's312 1603 parsed 'notice 'active 's312
1604 ?n nick ?s server-host ?c (erc-response.contents parsed)))) 1604 ?n nick ?s server-host ?c (erc-response.contents parsed))))
1612 (define-erc-response-handler (315 318 323 369) 1612 (define-erc-response-handler (315 318 323 369)
1613 ;; 315 - End of WHO 1613 ;; 315 - End of WHO
1614 ;; 318 - End of WHOIS list 1614 ;; 318 - End of WHOIS list
1615 ;; 323 - End of channel LIST 1615 ;; 323 - End of channel LIST
1616 ;; 369 - End of WHOWAS 1616 ;; 369 - End of WHOWAS
1617 nil nil 1617 "End of WHO/WHOIS/LIST/WHOWAS notices." nil
1618 (ignore proc parsed)) 1618 (ignore proc parsed))
1619 1619
1620 (define-erc-response-handler (317) 1620 (define-erc-response-handler (317)
1621 "IDLE notice." nil 1621 "IDLE notice." nil
1622 (multiple-value-bind (nick seconds-idle on-since time) 1622 (multiple-value-bind (nick seconds-idle on-since time)
1633 (erc-display-message 1633 (erc-display-message
1634 parsed 'notice 'active 's317 1634 parsed 'notice 'active 's317
1635 ?n nick ?i (erc-sec-to-time (string-to-number seconds-idle)))))) 1635 ?n nick ?i (erc-sec-to-time (string-to-number seconds-idle))))))
1636 1636
1637 (define-erc-response-handler (319) 1637 (define-erc-response-handler (319)
1638 nil nil 1638 "Channel names in WHOIS response." nil
1639 (erc-display-message 1639 (erc-display-message
1640 parsed 'notice 'active 's319 1640 parsed 'notice 'active 's319
1641 ?n (second (erc-response.command-args parsed)) 1641 ?n (second (erc-response.command-args parsed))
1642 ?c (erc-response.contents parsed))) 1642 ?c (erc-response.contents parsed)))
1643 1643
1681 (erc-display-message 1681 (erc-display-message
1682 parsed 'notice (erc-get-buffer channel proc) 1682 parsed 'notice (erc-get-buffer channel proc)
1683 's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time)))) 1683 's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time))))
1684 1684
1685 (define-erc-response-handler (330) 1685 (define-erc-response-handler (330)
1686 nil nil 1686 "Nick is authed as (on Quakenet network)." nil
1687 ;; FIXME: I don't know what the magic numbers mean. Mummy, make 1687 ;; FIXME: I don't know what the magic numbers mean. Mummy, make
1688 ;; the magic numbers go away. 1688 ;; the magic numbers go away.
1689 ;; No seriously, I have no clue about the format of this command, 1689 ;; No seriously, I have no clue about the format of this command,
1690 ;; and don't sit on Quakenet, so can't test. Originally we had: 1690 ;; and don't sit on Quakenet, so can't test. Originally we had:
1691 ;; nick == (aref parsed 3) 1691 ;; nick == (aref parsed 3)
1697 (authmsg (erc-response.contents parsed))) 1697 (authmsg (erc-response.contents parsed)))
1698 (erc-display-message parsed 'notice 'active 's330 1698 (erc-display-message parsed 'notice 'active 's330
1699 ?n nick ?a authmsg ?i authaccount))) 1699 ?n nick ?a authmsg ?i authaccount)))
1700 1700
1701 (define-erc-response-handler (331) 1701 (define-erc-response-handler (331)
1702 "Channel topic." nil 1702 "No topic set for channel." nil
1703 (let ((channel (second (erc-response.command-args parsed))) 1703 (let ((channel (second (erc-response.command-args parsed)))
1704 (topic (erc-response.contents parsed))) 1704 (topic (erc-response.contents parsed)))
1705 ;; FIXME: why don't we do anything with the topic? -- Lawrence 2004/05/10
1706 (erc-display-message parsed 'notice (erc-get-buffer channel proc) 1705 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1707 's331 ?c channel))) 1706 's331 ?c channel)))
1708 1707
1709 (define-erc-response-handler (332) 1708 (define-erc-response-handler (332)
1710 "TOPIC notice." nil 1709 "TOPIC notice." nil
1713 (erc-update-channel-topic channel topic) 1712 (erc-update-channel-topic channel topic)
1714 (erc-display-message parsed 'notice (erc-get-buffer channel proc) 1713 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1715 's332 ?c channel ?T topic))) 1714 's332 ?c channel ?T topic)))
1716 1715
1717 (define-erc-response-handler (333) 1716 (define-erc-response-handler (333)
1718 ;; Who set the topic, and when 1717 "Who set the topic, and when." nil
1719 nil nil
1720 (multiple-value-bind (channel nick time) 1718 (multiple-value-bind (channel nick time)
1721 (cdr (erc-response.command-args parsed)) 1719 (cdr (erc-response.command-args parsed))
1722 (setq time (format-time-string "%T %Y/%m/%d" 1720 (setq time (format-time-string "%T %Y/%m/%d"
1723 (erc-string-to-emacs-time time))) 1721 (erc-string-to-emacs-time time)))
1724 (erc-update-channel-topic channel 1722 (erc-update-channel-topic channel
1764 "End of NAMES." nil 1762 "End of NAMES." nil
1765 (erc-with-buffer ((second (erc-response.command-args parsed)) proc) 1763 (erc-with-buffer ((second (erc-response.command-args parsed)) proc)
1766 (erc-channel-end-receiving-names))) 1764 (erc-channel-end-receiving-names)))
1767 1765
1768 (define-erc-response-handler (367) 1766 (define-erc-response-handler (367)
1769 "Channel ban list entries" nil 1767 "Channel ban list entries." nil
1770 (multiple-value-bind (channel banmask setter time) 1768 (multiple-value-bind (channel banmask setter time)
1771 (cdr (erc-response.command-args parsed)) 1769 (cdr (erc-response.command-args parsed))
1772 ;; setter and time are not standard 1770 ;; setter and time are not standard
1773 (if setter 1771 (if setter
1774 (erc-display-message parsed 'notice 'active 's367-set-by 1772 (erc-display-message parsed 'notice 'active 's367-set-by
1779 (erc-display-message parsed 'notice 'active 's367 1777 (erc-display-message parsed 'notice 'active 's367
1780 ?c channel 1778 ?c channel
1781 ?b banmask)))) 1779 ?b banmask))))
1782 1780
1783 (define-erc-response-handler (368) 1781 (define-erc-response-handler (368)
1784 "End of channel ban list" nil 1782 "End of channel ban list." nil
1785 (let ((channel (second (erc-response.command-args parsed)))) 1783 (let ((channel (second (erc-response.command-args parsed))))
1786 (erc-display-message parsed 'notice 'active 's368 1784 (erc-display-message parsed 'notice 'active 's368
1787 ?c channel))) 1785 ?c channel)))
1788 1786
1789 (define-erc-response-handler (379) 1787 (define-erc-response-handler (379)
1795 (cdr (erc-response.command-args parsed)) 1793 (cdr (erc-response.command-args parsed))
1796 (erc-display-message parsed 'notice 'active 1794 (erc-display-message parsed 'notice 'active
1797 's379 ?c from ?f to))) 1795 's379 ?c from ?f to)))
1798 1796
1799 (define-erc-response-handler (391) 1797 (define-erc-response-handler (391)
1800 "Server's time string" nil 1798 "Server's time string." nil
1801 (erc-display-message 1799 (erc-display-message
1802 parsed 'notice 'active 1800 parsed 'notice 'active
1803 's391 ?s (second (erc-response.command-args parsed)) 1801 's391 ?s (second (erc-response.command-args parsed))
1804 ?t (third (erc-response.command-args parsed)))) 1802 ?t (third (erc-response.command-args parsed))))
1805 1803
1822 (erc-display-message parsed '(notice error) 'active 1820 (erc-display-message parsed '(notice error) 'active
1823 's404 ?c (second (erc-response.command-args parsed)))) 1821 's404 ?c (second (erc-response.command-args parsed))))
1824 1822
1825 1823
1826 (define-erc-response-handler (405) 1824 (define-erc-response-handler (405)
1827 ;; Can't join that many channels. 1825 "Can't join that many channels." nil
1828 nil nil
1829 (erc-display-message parsed '(notice error) 'active 1826 (erc-display-message parsed '(notice error) 'active
1830 's405 ?c (second (erc-response.command-args parsed)))) 1827 's405 ?c (second (erc-response.command-args parsed))))
1831 1828
1832 (define-erc-response-handler (406) 1829 (define-erc-response-handler (406)
1833 ;; No such nick 1830 "No such nick." nil
1834 nil nil
1835 (erc-display-message parsed '(notice error) 'active 1831 (erc-display-message parsed '(notice error) 'active
1836 's406 ?n (second (erc-response.command-args parsed)))) 1832 's406 ?n (second (erc-response.command-args parsed))))
1837 1833
1838 (define-erc-response-handler (412) 1834 (define-erc-response-handler (412)
1839 ;; No text to send 1835 "No text to send." nil
1840 nil nil
1841 (erc-display-message parsed '(notice error) 'active 's412)) 1836 (erc-display-message parsed '(notice error) 'active 's412))
1842 1837
1843 (define-erc-response-handler (421) 1838 (define-erc-response-handler (421)
1844 ;; Unknown command 1839 "Unknown command." nil
1845 nil nil
1846 (erc-display-message parsed '(notice error) 'active 's421 1840 (erc-display-message parsed '(notice error) 'active 's421
1847 ?c (second (erc-response.command-args parsed)))) 1841 ?c (second (erc-response.command-args parsed))))
1848 1842
1849 (define-erc-response-handler (432) 1843 (define-erc-response-handler (432)
1850 ;; Bad nick. 1844 "Bad nick." nil
1851 nil nil
1852 (erc-display-message parsed '(notice error) 'active 's432 1845 (erc-display-message parsed '(notice error) 'active 's432
1853 ?n (second (erc-response.command-args parsed)))) 1846 ?n (second (erc-response.command-args parsed))))
1854 1847
1855 (define-erc-response-handler (433) 1848 (define-erc-response-handler (433)
1856 ;; Login-time "nick in use" 1849 "Login-time \"nick in use\"." nil
1857 nil nil
1858 (erc-nickname-in-use (second (erc-response.command-args parsed)) 1850 (erc-nickname-in-use (second (erc-response.command-args parsed))
1859 "already in use")) 1851 "already in use"))
1860 1852
1861 (define-erc-response-handler (437) 1853 (define-erc-response-handler (437)
1862 ;; Nick temporarily unavailable (IRCnet) 1854 "Nick temporarily unavailable (on IRCnet)." nil
1863 nil nil
1864 (let ((nick/channel (second (erc-response.command-args parsed)))) 1855 (let ((nick/channel (second (erc-response.command-args parsed))))
1865 (unless (erc-channel-p nick/channel) 1856 (unless (erc-channel-p nick/channel)
1866 (erc-nickname-in-use nick/channel "temporarily unavailable")))) 1857 (erc-nickname-in-use nick/channel "temporarily unavailable"))))
1867 1858
1868 (define-erc-response-handler (442) 1859 (define-erc-response-handler (442)
1869 ;; Not on channel 1860 "Not on channel." nil
1870 nil nil
1871 (erc-display-message parsed '(notice error) 'active 's442 1861 (erc-display-message parsed '(notice error) 'active 's442
1872 ?c (second (erc-response.command-args parsed)))) 1862 ?c (second (erc-response.command-args parsed))))
1873 1863
1874 (define-erc-response-handler (461) 1864 (define-erc-response-handler (461)
1875 ;; Not enough params for command. 1865 "Not enough parameters for command." nil
1876 nil nil
1877 (erc-display-message parsed '(notice error) 'active 's461 1866 (erc-display-message parsed '(notice error) 'active 's461
1878 ?c (second (erc-response.command-args parsed)) 1867 ?c (second (erc-response.command-args parsed))
1879 ?m (erc-response.contents parsed))) 1868 ?m (erc-response.contents parsed)))
1880 1869
1881 (define-erc-response-handler (465) 1870 (define-erc-response-handler (465)
1885 (erc-display-error-notice 1874 (erc-display-error-notice
1886 parsed 1875 parsed
1887 (erc-response.contents parsed))) 1876 (erc-response.contents parsed)))
1888 1877
1889 (define-erc-response-handler (474) 1878 (define-erc-response-handler (474)
1890 "Banned from channel errors" nil 1879 "Banned from channel errors." nil
1891 (erc-display-message parsed '(notice error) nil 1880 (erc-display-message parsed '(notice error) nil
1892 (intern (format "s%s" 1881 (intern (format "s%s"
1893 (erc-response.command parsed))) 1882 (erc-response.command parsed)))
1894 ?c (second (erc-response.command-args parsed)))) 1883 ?c (second (erc-response.command-args parsed))))
1895 1884
1904 (second (erc-response.command-args parsed)))))) 1893 (second (erc-response.command-args parsed))))))
1905 (when (and key (> (length key) 0)) 1894 (when (and key (> (length key) 0))
1906 (erc-cmd-JOIN channel key))))) 1895 (erc-cmd-JOIN channel key)))))
1907 1896
1908 (define-erc-response-handler (477) 1897 (define-erc-response-handler (477)
1909 nil nil 1898 "Channel doesn't support modes." nil
1910 (let ((channel (second (erc-response.command-args parsed))) 1899 (let ((channel (second (erc-response.command-args parsed)))
1911 (message (erc-response.contents parsed))) 1900 (message (erc-response.contents parsed)))
1912 (erc-display-message parsed 'notice (erc-get-buffer channel proc) 1901 (erc-display-message parsed 'notice (erc-get-buffer channel proc)
1913 (format "%s: %s" channel message)))) 1902 (format "%s: %s" channel message))))
1914 1903
1915 (define-erc-response-handler (482) 1904 (define-erc-response-handler (482)
1916 nil nil 1905 "You need to be a channel operator to do that." nil
1917 (let ((channel (second (erc-response.command-args parsed))) 1906 (let ((channel (second (erc-response.command-args parsed)))
1918 (message (erc-response.contents parsed))) 1907 (message (erc-response.contents parsed)))
1919 (erc-display-message parsed '(error notice) 'active 's482 1908 (erc-display-message parsed '(error notice) 'active 's482
1920 ?c channel ?m message))) 1909 ?c channel ?m message)))
1921 1910
1933 ;; 484 - Your connection is restricted! 1922 ;; 484 - Your connection is restricted!
1934 ;; 485 - You're not the original channel operator 1923 ;; 485 - You're not the original channel operator
1935 ;; 491 - No O-lines for your host 1924 ;; 491 - No O-lines for your host
1936 ;; 501 - Unknown MODE flag 1925 ;; 501 - Unknown MODE flag
1937 ;; 502 - Cannot change mode for other users 1926 ;; 502 - Cannot change mode for other users
1938 nil nil 1927 "Generic display of server error messages.
1928
1929 See `erc-display-error-notice'." nil
1939 (erc-display-error-notice 1930 (erc-display-error-notice
1940 parsed 1931 parsed
1941 (intern (format "s%s" (erc-response.command parsed))))) 1932 (intern (format "s%s" (erc-response.command parsed)))))
1942 1933
1943 ;; FIXME: These are yet to be implemented, they're just stubs for now 1934 ;; FIXME: These are yet to be implemented, they're just stubs for now