comparison libpurple/protocols/jabber/buddy.c @ 18698:b5546f8f8c71

Now displaying a contact's client's capabilities in the info text if that client supports the caps extension.
author Andreas Monitzer <pidgin@monitzer.com>
date Tue, 17 Jul 2007 18:15:34 +0000
parents 5c1ed6296b56
children b0733d5d7621
comparison
equal deleted inserted replaced
18697:27fcb91ae08a 18698:b5546f8f8c71
797 797
798 if(jbr->client.os) { 798 if(jbr->client.os) {
799 purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); 799 purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os);
800 } 800 }
801 } 801 }
802 if(jbr && jbr->caps) {
803 GString *tmp = g_string_new("");
804 GList *iter;
805 for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) {
806 const char *feature = iter->data;
807
808 if(!strcmp(feature, "jabber:iq:last"))
809 feature = _("Last Activity");
810 else if(!strcmp(feature, "http://jabber.org/protocol/disco#info"))
811 feature = _("Service Discovery Info");
812 else if(!strcmp(feature, "http://jabber.org/protocol/disco#items"))
813 feature = _("Service Discovery Items");
814 else if(!strcmp(feature, "http://jabber.org/protocol/address"))
815 feature = _("Extended Stanza Addressing");
816 else if(!strcmp(feature, "http://jabber.org/protocol/muc"))
817 feature = _("Multi-User Chat");
818 else if(!strcmp(feature, "http://jabber.org/protocol/muc#user"))
819 feature = _("Multi-User Chat Extended Presence Information");
820 else if(!strcmp(feature, "http://jabber.org/protocol/ibb"))
821 feature = _("In-Band Bytestreams");
822 else if(!strcmp(feature, "http://jabber.org/protocol/commands"))
823 feature = _("Ad-Hoc Commands");
824 else if(!strcmp(feature, "http://jabber.org/protocol/pubsub"))
825 feature = _("PubSub Service");
826 else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams"))
827 feature = _("SOCKS5 Bytestreams");
828 else if(!strcmp(feature, "jabber:x:oob"))
829 feature = _("Out of Band Data");
830 else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im"))
831 feature = _("XHTML-IM");
832 else if(!strcmp(feature, "jabber:iq:register"))
833 feature = _("In-Band Registration");
834 else if(!strcmp(feature, "http://jabber.org/protocol/geoloc"))
835 feature = _("User Location");
836 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html"))
837 feature = _("User Avatar");
838 else if(!strcmp(feature, "http://jabber.org/protocol/chatstates"))
839 feature = _("Chat State Notifications");
840 else if(!strcmp(feature, "jabber:iq:version"))
841 feature = _("Software Version");
842 else if(!strcmp(feature, "http://jabber.org/protocol/si"))
843 feature = _("Stream Initiation");
844 else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer"))
845 feature = _("File Transfer");
846 else if(!strcmp(feature, "http://jabber.org/protocol/mood"))
847 feature = _("User Mood");
848 else if(!strcmp(feature, "http://jabber.org/protocol/activity"))
849 feature = _("User Activity");
850 else if(!strcmp(feature, "http://jabber.org/protocol/caps"))
851 feature = _("Entity Capabilities");
852 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html"))
853 feature = _("Encrypted Session Negotiations");
854 else if(!strcmp(feature, "http://jabber.org/protocol/tune"))
855 feature = _("User Tune");
856 else if(!strcmp(feature, "http://jabber.org/protocol/rosterx"))
857 feature = _("Roster Item Exchange");
858 else if(!strcmp(feature, "http://jabber.org/protocol/reach"))
859 feature = _("Reachability Address");
860 else if(!strcmp(feature, "http://jabber.org/protocol/profile"))
861 feature = _("User Profile");
862 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns"))
863 feature = _("Jingle");
864 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns"))
865 feature = _("Jingle Audio");
866 else if(!strcmp(feature, "http://jabber.org/protocol/nick"))
867 feature = _("User Nickname");
868 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp"))
869 feature = _("Jingle ICE UDP");
870 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp"))
871 feature = _("Jingle ICE TCP");
872 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns"))
873 feature = _("Jingle Raw UDP");
874 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns"))
875 feature = _("Jingle Video");
876 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns"))
877 feature = _("Jingle DTMF");
878 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns"))
879 feature = _("Message Receipts");
880 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns"))
881 feature = _("Public Key Publishing");
882 else if(!strcmp(feature, "http://jabber.org/protocol/chatting"))
883 feature = _("User Chatting");
884 else if(!strcmp(feature, "http://jabber.org/protocol/browsing"))
885 feature = _("User Browsing");
886 else if(!strcmp(feature, "http://jabber.org/protocol/gaming"))
887 feature = _("User Gaming");
888 else if(!strcmp(feature, "http://jabber.org/protocol/viewing"))
889 feature = _("User Viewing");
890 else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns"))
891 feature = _("Ping");
892 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns"))
893 feature = _("Stanza Encryption");
894 else if(!strcmp(feature, "urn:xmpp:time"))
895 feature = _("Entity Time");
896 else if(!strcmp(feature, "urn:xmpp:delay"))
897 feature = _("Delayed Delivery");
898 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns"))
899 feature = _("Collaborative Data Objects");
900 else if(!strcmp(feature, "http://jabber.org/protocol/fileshare"))
901 feature = _("File Repository and Sharing");
902 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns"))
903 feature = _("STUN Service Discovery for Jingle");
904 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns"))
905 feature = _("Simplified Encrypted Session Negotiation");
906 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns"))
907 feature = _("Hop Check");
908 else if(g_str_has_suffix(feature, "+notify"))
909 feature = NULL;
910
911 if(feature)
912 g_string_append_printf(tmp, "%s\n", feature);
913 }
914 if(strlen(tmp->str) > 0)
915 purple_notify_user_info_add_pair(user_info, _("Capabilities"), tmp->str);
916
917 g_string_free(tmp, TRUE);
918 }
802 } else { 919 } else {
803 for(resources = jbi->jb->resources; resources; resources = resources->next) { 920 for(resources = jbi->jb->resources; resources; resources = resources->next) {
804 char *purdy = NULL; 921 char *purdy = NULL;
805 jbr = resources->data; 922 jbr = resources->data;
806 if(jbr->status) 923 if(jbr->status)
837 g_free(tmp); 954 g_free(tmp);
838 955
839 if(jbr->client.os) { 956 if(jbr->client.os) {
840 purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os); 957 purple_notify_user_info_add_pair(user_info, _("Operating System"), jbr->client.os);
841 } 958 }
959 }
960 if(jbr && jbr->caps) {
961 GString *tmp = g_string_new("");
962 GList *iter;
963 for(iter = jbr->caps->features; iter; iter = g_list_next(iter)) {
964 const char *feature = iter->data;
965
966 if(!strcmp(feature, "jabber:iq:last"))
967 feature = _("Last Activity");
968 else if(!strcmp(feature, "http://jabber.org/protocol/disco#info"))
969 feature = _("Service Discovery Info");
970 else if(!strcmp(feature, "http://jabber.org/protocol/disco#items"))
971 feature = _("Service Discovery Items");
972 else if(!strcmp(feature, "http://jabber.org/protocol/address"))
973 feature = _("Extended Stanza Addressing");
974 else if(!strcmp(feature, "http://jabber.org/protocol/muc"))
975 feature = _("Multi-User Chat");
976 else if(!strcmp(feature, "http://jabber.org/protocol/muc#user"))
977 feature = _("Multi-User Chat Extended Presence Information");
978 else if(!strcmp(feature, "http://jabber.org/protocol/ibb"))
979 feature = _("In-Band Bytestreams");
980 else if(!strcmp(feature, "http://jabber.org/protocol/commands"))
981 feature = _("Ad-Hoc Commands");
982 else if(!strcmp(feature, "http://jabber.org/protocol/pubsub"))
983 feature = _("PubSub Service");
984 else if(!strcmp(feature, "http://jabber.org/protocol/bytestreams"))
985 feature = _("SOCKS5 Bytestreams");
986 else if(!strcmp(feature, "jabber:x:oob"))
987 feature = _("Out of Band Data");
988 else if(!strcmp(feature, "http://jabber.org/protocol/xhtml-im"))
989 feature = _("XHTML-IM");
990 else if(!strcmp(feature, "jabber:iq:register"))
991 feature = _("In-Band Registration");
992 else if(!strcmp(feature, "http://jabber.org/protocol/geoloc"))
993 feature = _("User Location");
994 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0084.html"))
995 feature = _("User Avatar");
996 else if(!strcmp(feature, "http://jabber.org/protocol/chatstates"))
997 feature = _("Chat State Notifications");
998 else if(!strcmp(feature, "jabber:iq:version"))
999 feature = _("Software Version");
1000 else if(!strcmp(feature, "http://jabber.org/protocol/si"))
1001 feature = _("Stream Initiation");
1002 else if(!strcmp(feature, "http://jabber.org/protocol/si/profile/file-transfer"))
1003 feature = _("File Transfer");
1004 else if(!strcmp(feature, "http://jabber.org/protocol/mood"))
1005 feature = _("User Mood");
1006 else if(!strcmp(feature, "http://jabber.org/protocol/activity"))
1007 feature = _("User Activity");
1008 else if(!strcmp(feature, "http://jabber.org/protocol/caps"))
1009 feature = _("Entity Capabilities");
1010 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html"))
1011 feature = _("Encrypted Session Negotiations");
1012 else if(!strcmp(feature, "http://jabber.org/protocol/tune"))
1013 feature = _("User Tune");
1014 else if(!strcmp(feature, "http://jabber.org/protocol/rosterx"))
1015 feature = _("Roster Item Exchange");
1016 else if(!strcmp(feature, "http://jabber.org/protocol/reach"))
1017 feature = _("Reachability Address");
1018 else if(!strcmp(feature, "http://jabber.org/protocol/profile"))
1019 feature = _("User Profile");
1020 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0166.html#ns"))
1021 feature = _("Jingle");
1022 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0167.html#ns"))
1023 feature = _("Jingle Audio");
1024 else if(!strcmp(feature, "http://jabber.org/protocol/nick"))
1025 feature = _("User Nickname");
1026 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-udp"))
1027 feature = _("Jingle ICE UDP");
1028 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0176.html#ns-tcp"))
1029 feature = _("Jingle ICE TCP");
1030 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0177.html#ns"))
1031 feature = _("Jingle Raw UDP");
1032 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0180.html#ns"))
1033 feature = _("Jingle Video");
1034 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0181.html#ns"))
1035 feature = _("Jingle DTMF");
1036 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0184.html#ns"))
1037 feature = _("Message Receipts");
1038 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0189.html#ns"))
1039 feature = _("Public Key Publishing");
1040 else if(!strcmp(feature, "http://jabber.org/protocol/chatting"))
1041 feature = _("User Chatting");
1042 else if(!strcmp(feature, "http://jabber.org/protocol/browsing"))
1043 feature = _("User Browsing");
1044 else if(!strcmp(feature, "http://jabber.org/protocol/gaming"))
1045 feature = _("User Gaming");
1046 else if(!strcmp(feature, "http://jabber.org/protocol/viewing"))
1047 feature = _("User Viewing");
1048 else if(!strcmp(feature, "urn:xmpp:ping") || !strcmp(feature, "http://www.xmpp.org/extensions/xep-0199.html#ns"))
1049 feature = _("Ping");
1050 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0200.html#ns"))
1051 feature = _("Stanza Encryption");
1052 else if(!strcmp(feature, "urn:xmpp:time"))
1053 feature = _("Entity Time");
1054 else if(!strcmp(feature, "urn:xmpp:delay"))
1055 feature = _("Delayed Delivery");
1056 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0204.html#ns"))
1057 feature = _("Collaborative Data Objects");
1058 else if(!strcmp(feature, "http://jabber.org/protocol/fileshare"))
1059 feature = _("File Repository and Sharing");
1060 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0215.html#ns"))
1061 feature = _("STUN Service Discovery for Jingle");
1062 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0116.html#ns"))
1063 feature = _("Simplified Encrypted Session Negotiation");
1064 else if(!strcmp(feature, "http://www.xmpp.org/extensions/xep-0219.html#ns"))
1065 feature = _("Hop Check");
1066 else if(g_str_has_suffix(feature, "+notify"))
1067 feature = NULL;
1068
1069 if(feature)
1070 g_string_append_printf(tmp, "%s\n", feature);
1071 }
1072 if(strlen(tmp->str) > 0)
1073 purple_notify_user_info_add_pair(user_info, _("Capabilities"), tmp->str);
1074
1075 g_string_free(tmp, TRUE);
842 } 1076 }
843 } 1077 }
844 } 1078 }
845 1079
846 g_free(resource_name); 1080 g_free(resource_name);