;;; emchat-meta.el --- User meta info code for EMchat ;; Copyright (C) 2002 - 2011 Steve Youngs ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: 2002-10-02 ;; Homepage: http://www.emchat.org/ ;; Keywords: comm ICQ ;; This file is part of EMchat. ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions ;; are met: ;; ;; 1. Redistributions of source code must retain the above copyright ;; notice, this list of conditions and the following disclaimer. ;; ;; 2. Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; ;; 3. Neither the name of the author nor the names of any contributors ;; may be used to endorse or promote products derived from this ;; software without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (defgroup emchat-meta nil "User info stored in ICQ server. Run `emchat-update-meta-info' after changing any of these variables." :prefix "emchat-user-meta-" :group 'emchat) (defcustom emchat-user-meta-nickname "e-i-c-q" "*Your nickname stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable. ICQ server refuses any string containing substring \"icq\"." :group 'emchat-meta) (defcustom emchat-user-meta-firstname "SXEmacs" "*Your first name stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable. ICQ server refuses any string containing substring \"icq\"." :group 'emchat-meta) (defcustom emchat-user-meta-lastname "Linux" "*Your last name stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable. ICQ server refuses any string containing substring \"icq\"." :group 'emchat-meta) (defcustom emchat-user-meta-primary-email "emacs@home.com" "*Your primary email address stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable. ICQ server refuses any string containing substring \"icq\"." :group 'emchat-meta) (defcustom emchat-user-meta-secondary-email "emchat@home.com" "*Your secondary email address stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-old-email "emchat@home.com" "*Your old email address stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-city nil "*Your city stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-state nil "*Your state stored on the ICQ server. We're talking 'address' here, not online state. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-phone nil "*Your phone number stored on the ICQ server. Do you really want to divulge this information? Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-fax nil "*Your fax number stored on the ICQ server. Do you really want to divulge this information? Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-street nil "*Your street name and number stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-cell-phone nil "*Your cell phone number stored on the ICQ server. Do you really want to divulge this information? Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-zipcode nil "*Your zip code/postal code stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-country nil "*Your country stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-web-aware t "*Set this to non-nil if you want your presence know on the web." :type 'boolean :group 'emchat-meta) (defcustom emchat-user-meta-invisible nil "*Set to non-nil to be \"invisible\" to other ICQ users. Having your status set to \"invisible\" is a little different from other statuses in that you can be \"invisible\" at the same time as being \"online\", \"away\", \"occ\", \"dnd\", or \"na\"." :type 'boolean :group 'emchat-meta) (defcustom emchat-user-meta-invisibility-indicator "/inv" "String to indicate your visibility. It is displayed as part of your status, eg: [JackaLX]: " :type 'string :group 'emchat-meta) (defcustom emchat-user-meta-hide-ip nil "*Set to non-nil if you want to hide your IP. Run `emchat-update-meta-info' after modifying this variable." :type 'boolean :group 'emchat-meta) (defcustom emchat-user-meta-authorization t "*Authorization needed to add you to others' contact lists.. Run `emchat-update-meta-info' after modifying this variable." :type 'boolean :group 'emchat-meta) (defcustom emchat-user-meta-about "Give a man a new Emacs command, and he can hack for a night; Teach a man to make new Emacs commands, and he can hack for a life time." "*User 'about' info stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-homepage "http://www.emchat.org/" "*User homepage stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-age 65535 "*Your age stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable. 65535 = not entered." :group 'emchat-meta) (defcustom emchat-user-meta-sex 'not-entered "*Your sex stored on the ICQ server. No, it's not an invitation. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta :type '(choice (item male) (item female) (item not-entered))) (defcustom emchat-user-meta-birth-year nil "*Your birth year (YY) stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-birth-month nil "*Your birth month (MM) stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-birth-day nil "*Your birth day (DD) stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-language-1 0 "*User 1st language stored on the ICQ server. Possible values are: 0 Unspecified 7 Chinese 17 French 27 Japanese 36 Portuguese 46 Tagalog 55 Afrikaans 8 Croatian 18 Gaelic 28 Khmer 37 Romanian 47 Tatar 58 Albanian 9 Czech 19 German 29 Korean 38 Russian 48 Thai 1 Arabic 10 Danish 20 Greek 30 Lao 39 Serbian 49 Turkish 59 Armenian 11 Dutch 21 Hebrew 31 Latvian 40 Slovak 50 Ukrainian 2 Bhojpuri 12 English 22 Hindi 32 Lithuanian 41 Slovenian 51 Urdu 3 Bulgarian 13 Esperanto 23 Hungarian 33 Malay 42 Somali 52 Vietnamese 4 Burmese 14 Estonian 24 Icelandic 34 Norwegian 43 Spanish 53 Yiddish 5 Cantonese 15 Farsi 25 Indonesian 57 Persian 44 Swahili 54 Yoruba 6 Catalan 16 Finnish 26 Italian 35 Polish 45 Swedish Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-language-2 0 "*User 2nd language stored on the ICQ server. Possible values are: 0 Unspecified 7 Chinese 17 French 27 Japanese 36 Portuguese 46 Tagalog 55 Afrikaans 8 Croatian 18 Gaelic 28 Khmer 37 Romanian 47 Tatar 58 Albanian 9 Czech 19 German 29 Korean 38 Russian 48 Thai 1 Arabic 10 Danish 20 Greek 30 Lao 39 Serbian 49 Turkish 59 Armenian 11 Dutch 21 Hebrew 31 Latvian 40 Slovak 50 Ukrainian 2 Bhojpuri 12 English 22 Hindi 32 Lithuanian 41 Slovenian 51 Urdu 3 Bulgarian 13 Esperanto 23 Hungarian 33 Malay 42 Somali 52 Vietnamese 4 Burmese 14 Estonian 24 Icelandic 34 Norwegian 43 Spanish 53 Yiddish 5 Cantonese 15 Farsi 25 Indonesian 57 Persian 44 Swahili 54 Yoruba 6 Catalan 16 Finnish 26 Italian 35 Polish 45 Swedish Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-language-3 0 "*User 3rd language stored on the ICQ server. Possible values are: 0 Unspecified 7 Chinese 17 French 27 Japanese 36 Portuguese 46 Tagalog 55 Afrikaans 8 Croatian 18 Gaelic 28 Khmer 37 Romanian 47 Tatar 58 Albanian 9 Czech 19 German 29 Korean 38 Russian 48 Thai 1 Arabic 10 Danish 20 Greek 30 Lao 39 Serbian 49 Turkish 59 Armenian 11 Dutch 21 Hebrew 31 Latvian 40 Slovak 50 Ukrainian 2 Bhojpuri 12 English 22 Hindi 32 Lithuanian 41 Slovenian 51 Urdu 3 Bulgarian 13 Esperanto 23 Hungarian 33 Malay 42 Somali 52 Vietnamese 4 Burmese 14 Estonian 24 Icelandic 34 Norwegian 43 Spanish 53 Yiddish 5 Cantonese 15 Farsi 25 Indonesian 57 Persian 44 Swahili 54 Yoruba 6 Catalan 16 Finnish 26 Italian 35 Polish 45 Swedish Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-city nil "*User work city stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-state nil "*User work state stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-phone nil "*User work phone number stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-fax nil "*User work fax number stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-address nil "*User work address stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-company nil "*User company stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-department nil "*User work department stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-position nil "*User work position stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) (defcustom emchat-user-meta-work-homepage "http://www.emchat.org/" "*User work homepage stored on the ICQ server. Run `emchat-update-meta-info' after modifying this variable." :group 'emchat-meta) ;;; Internal variables (defvar emchat-monthnames ["0" "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"]) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-pack-meta-user-update-general () ; "Pack meta user packet 064a:03e8. ; `M-x customize-group RET emchat-info' before this." ; (emchat-pack ; "\x4a\x06" ; "\xe8\x03" ; (emchat-int-bin (length emchat-user-meta-nickname)) ; emchat-user-meta-nickname ; (emchat-int-bin (length emchat-user-meta-firstname)) ; emchat-user-meta-firstname ; (emchat-int-bin (length emchat-user-meta-lastname)) ; emchat-user-meta-lastname ; (emchat-int-bin (length emchat-user-meta-primary-email)) ; emchat-user-meta-primary-email ; (emchat-int-bin (length emchat-user-meta-secondary-email)) ; emchat-user-meta-secondary-email ; (emchat-int-bin (length emchat-user-meta-old-email)) ; emchat-user-meta-old-email ; (emchat-int-bin (length emchat-user-meta-city)) ; emchat-user-meta-city ; (emchat-int-bin (length emchat-user-meta-state)) ; emchat-user-meta-state ; (emchat-int-bin (length emchat-user-meta-phone)) ; emchat-user-meta-phone ; (emchat-int-bin (length emchat-user-meta-fax)) ; emchat-user-meta-fax ; (emchat-int-bin (length emchat-user-meta-street)) ; emchat-user-meta-street ; (emchat-int-bin (length emchat-user-meta-cell-phone)) ; emchat-user-meta-cell-phone ; ;; zip code? only accept valid values ; "\x00\x00\x00\x00" ; (emchat-int-bin (car (rassoc emchat-user-meta-country emchat-country-code))))) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-pack-meta-user-security () ; "Pack meta user packet 064a:0424." ; (emchat-pack ; "\x4a\x06" ; "\x24\x04" ; (if emchat-user-meta-authorization ; "\x00" ; "\x01") ; (if emchat-user-meta-web-aware ; "\x01" ; "\x00") ; (if emchat-user-meta-hide-ip ; "\x00" ; "\x01"))) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-pack-meta-user-update-work () ; "Pack meta user packet 064a:03f2. ; `M-x customize-group RET emchat-info' before this." ; (emchat-pack ; "\x4a\x06" ; "\xf2\x03" ; (emchat-int-bin (length emchat-user-meta-work-city)) ; emchat-user-meta-work-city ; (emchat-int-bin (length emchat-user-meta-work-state)) ; emchat-user-meta-work-state ; (emchat-int-bin (length emchat-user-meta-work-phone)) ; emchat-user-meta-work-phone ; (emchat-int-bin (length emchat-user-meta-work-fax)) ; emchat-user-meta-work-fax ; (emchat-int-bin (length emchat-user-meta-work-address)) ; emchat-user-meta-work-address ; ;; unknown ; "\x00\x00\x00\x00\x00\x00" ; (emchat-int-bin (length emchat-user-meta-work-company)) ; emchat-user-meta-work-company ; (emchat-int-bin (length emchat-user-meta-work-department)) ; emchat-user-meta-work-department ; (emchat-int-bin (length emchat-user-meta-work-position)) ; emchat-user-meta-work-position ; ;; unknown ; "\x00\x00" ; (emchat-int-bin (length emchat-user-meta-work-homepage)) ; emchat-user-meta-work-homepage)) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-pack-meta-user-update-more () ; "Pack meta user packet 064a:03fc. ; `M-x customize-group RET emchat-info' before this." ; (emchat-pack ; "\x4a\x06" ; "\xfc\x03" ; (emchat-int-bin emchat-user-meta-age) ; (case emchat-user-meta-sex ; (male "\x02") ; (female "\x01") ; (otherwise "\x00")) ; (emchat-int-bin (length emchat-user-meta-homepage)) ; emchat-user-meta-homepage ; (emchat-int-byte emchat-user-meta-birth-year) ; (emchat-int-byte emchat-user-meta-birth-month) ; (emchat-int-byte emchat-user-meta-birth-day) ; (emchat-int-byte emchat-user-meta-language-1) ; (emchat-int-byte emchat-user-meta-language-2) ; (emchat-int-byte emchat-user-meta-language-3))) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-pack-meta-user-update-about () ; "Pack meta user packet 064a:0406. ; `M-x customize-group RET emchat-info' before this." ; (emchat-pack ; "\x4a\x06" ; "\x06\x04" ; (emchat-int-bin (length emchat-user-meta-about)) ; emchat-user-meta-about)) ;;; FIXME: This needs to be updated for v8 ; (defvar emchat-do-meta-alist ; '(("\x64\x00" . emchat-do-meta-user-update-general-confirm) ; ("\x6e\x00" . emchat-do-meta-user-update-work-confirm) ; ("\x78\x00" . emchat-do-meta-user-update-more-confirm) ; ("\x82\x00" . emchat-do-meta-user-update-about-confirm) ; ("\xaa\x00" . emchat-do-meta-user-password) ; ("\xc8\x00" . emchat-do-meta-user-general) ; ("\xd2\x00" . emchat-do-meta-user-work) ; ("\xdc\x00" . emchat-do-meta-user-more) ; ("\xe6\x00" . emchat-do-meta-user-about) ; ("\xf0\x00" . emchat-do-meta-user-interest) ; ("\xfa\x00" . emchat-do-meta-user-background) ; ("\x0e\x01" . emchat-do-meta-user-picture) ; ("\x9a\x01" . emchat-do-meta-user-found)) ; "Handlers for server packet meta user subcommands.") ;;; FIXME: This needs to be updated for v8 ; (defun emchat-do-meta-user (packet) ; "Handle server command 03de in PACKET." ; (let* ((subcommand (substring packet 21 23)) ; (result (substring packet 23 24)) ; (data (substring packet 24)) ; (handler (cdr (assoc subcommand emchat-do-meta-alist)))) ; (if (not (equal result "\x0a")) ; (emchat-log-info "meta user command failed") ; (if (fboundp handler) ; (funcall handler data) ; (emchat-do-meta-user-unknown packet))))) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-do-meta-user-unknown (packet) ; "Handle server command 03de unknown subcommands in PACKET." ; (emchat-log-debug ; "meta user subcommand %s unhandled = %s" ; (emchat-bin-hex (substring packet 21 23)) ; (emchat-bin-pretty-hex (substring packet 24)))) ;;; FIXME: This needs to be updated for v8 ; (defun emchat-update-meta-info () ; "Update user meta info on the ICQ server. ; Run this after changing any meta user info variables." ; (interactive) ; ;(emchat-send (emchat-pack-update-authorization)) ; (emchat-send (emchat-pack-meta-user-security)) ; (emchat-send (emchat-pack-meta-user-update-general)) ; (emchat-send (emchat-pack-meta-user-update-work)) ; (emchat-send (emchat-pack-meta-user-update-more)) ; (emchat-send (emchat-pack-meta-user-update-about))) (provide 'emchat-meta) ;;; emchat-status.el ends here