~mateo-salta/touch-rss-scope/utfeed1

« back to all changes in this revision

Viewing changes to src/scope/query.cpp

  • Committer: Mateo Salta
  • Date: 2014-12-01 23:08:28 UTC
  • Revision ID: mateo_salta@yahoo.com-20141201230828-q8524cdcggeabf38
Added Ask Ubuntu!

Show diffs side-by-side

added added

removed removed

Lines of Context:
125
125
        // Create two other departments
126
126
        sc::Department::SPtr custom_department = sc::Department::create("Custom", query(), "Custom");
127
127
        sc::Department::SPtr ubuntu_department = sc::Department::create("Ubuntu", query(), "Ubuntu");
 
128
 
 
129
        sc::Department::SPtr au_department = sc::Department::create("Ask Ubuntu", query(), "Ask Ubuntu");
 
130
 
 
131
        sc::Department::SPtr tag_department = sc::Department::create("Top Tags", query(), "Top Tags");
 
132
//////////TAGGGGGGGGGGGGGGGGGGGGGSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
 
133
        sc::Department::SPtr installation_department = sc::Department::create("Installation", query(), "Installation");
 
134
        sc::Department::SPtr boot_department = sc::Department::create("Boot", query(), "Boot");
 
135
        sc::Department::SPtr unity_department = sc::Department::create("Unity", query(), "Unity");
 
136
        sc::Department::SPtr wireless_department = sc::Department::create("Wireless", query(), "Wireless");
 
137
        sc::Department::SPtr networking_department = sc::Department::create("Networking", query(), "Networking");
 
138
        sc::Department::SPtr commandline_department = sc::Department::create("Command Line", query(), "Command Line");
 
139
        sc::Department::SPtr dualboot_department = sc::Department::create("Dual Boot", query(), "Dual Boot");
 
140
        sc::Department::SPtr drivers_department = sc::Department::create("Drivers", query(), "Drivers");
 
141
        sc::Department::SPtr server_department = sc::Department::create("Server", query(), "Server");
 
142
        sc::Department::SPtr grub2_department = sc::Department::create("Grub2", query(), "Grub2");
 
143
        sc::Department::SPtr apt_department = sc::Department::create("Apt", query(), "Apt");
 
144
        sc::Department::SPtr gnome_department = sc::Department::create("Gnome", query(), "Gnome");
 
145
        sc::Department::SPtr partitioning_department = sc::Department::create("Partitioning", query(), "Partitioning");
 
146
        sc::Department::SPtr nvidia_department = sc::Department::create("NVIDIA", query(), "NVIDIA");
 
147
        sc::Department::SPtr ati_department = sc::Department::create("ATI", query(), "ATI");
 
148
        sc::Department::SPtr upgrade_department = sc::Department::create("Upgrade", query(), "Upgrade");
 
149
        sc::Department::SPtr sound_department = sc::Department::create("Sound", query(), "Sound");
 
150
 
 
151
 
 
152
 
128
153
        // Register these as subdepartments of the root
129
154
        all_depts->set_subdepartments({custom_department,
130
 
                                       ubuntu_department});
 
155
                                       ubuntu_department,
 
156
                                       au_department});
 
157
        au_department->set_subdepartments({tag_department});
 
158
 
 
159
        tag_department->set_subdepartments({installation_department,
 
160
                                           boot_department,
 
161
                                           unity_department,
 
162
                                           wireless_department,
 
163
                                           networking_department,
 
164
                                           commandline_department,
 
165
                                           dualboot_department,
 
166
                                           drivers_department,
 
167
                                           server_department,
 
168
                                           grub2_department,
 
169
                                           apt_department,
 
170
                                           gnome_department,
 
171
                                           partitioning_department,
 
172
                                           nvidia_department,
 
173
                                           ati_department,
 
174
                                           upgrade_department,
 
175
                                           sound_department,});
131
176
        // Register departments on the reply
132
177
        reply->register_departments(all_depts);
133
178
 
640
685
                                }
641
686
                                ///CUSTOM4
642
687
                                ///
 
688
                                ///
 
689
                                ///
 
690
 
 
691
                                /////////////////////////////////////////////////
 
692
                                ////////
 
693
                                ///
 
694
                                ///
 
695
                                /// UBUNTU ASK
 
696
                                ///
 
697
                                /// ///////////////////////////////////
 
698
 
 
699
 
 
700
                                ///
 
701
                                    if (department == "Ask Ubuntu") { ///DEPARTMENT
 
702
                                            ///OMGS
 
703
                                            Client::Metas metas;
 
704
 
 
705
 
 
706
 
 
707
                                            // If there is no search string, get the
 
708
                                            metas = client_.add_metas("http://meta.askubuntu.com/feeds", lang_sys, rest_sys);
 
709
                                            // Register a category for the
 
710
                                            auto meta_cat = reply->register_category("Meta",
 
711
                                                                                         _("Meta"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
712
                                            // For each of the forecast days
 
713
                                            for (const auto &meta : metas.meta) {
 
714
                                                // Create a result
 
715
                                                sc::CategorisedResult res(meta_cat);
 
716
 
 
717
                                                // We must have a URI
 
718
                                                res.set_uri(meta.link);
 
719
 
 
720
                                                res.set_title(meta.title);
 
721
                                                //res.set_art(meta.icon);
 
722
                                                // Set the rest of the attributes
 
723
                                                res.set_art("http://www.google.com/s2/favicons?domain=" + meta.link);
 
724
                                                res["subtitle"] = meta.author;
 
725
                                                res["date"] = meta.publishedDate;
 
726
                                                res["description"] = meta.content;
 
727
                                                // Push the result
 
728
                                                if (!reply->push(res)) {
 
729
                                                    // If we fail to push, it means the query has been cancelled.
 
730
                                                    // So don't continue;
 
731
                                                    return;
 
732
                                                }
 
733
                                                }
 
734
                                                }
 
735
                                            ///OMGS
 
736
                                ///
 
737
 
 
738
                                    if (department == "Ask Ubuntu") { ///DEPARTMENT
 
739
                                            ///OMGS
 
740
                                            Client::Actives actives;
 
741
 
 
742
 
 
743
 
 
744
                                            // If there is no search string, get the
 
745
                                            actives = client_.add_actives("http://www.askubuntu.com/feeds", lang_sys, rest_sys);
 
746
                                            // Register a category for the
 
747
                                            auto active_cat = reply->register_category("Active",
 
748
                                                                                         _("Active"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
749
                                            // For each of the forecast days
 
750
                                            for (const auto &active : actives.active) {
 
751
                                                // Create a result
 
752
                                                sc::CategorisedResult res(active_cat);
 
753
 
 
754
                                                // We must have a URI
 
755
                                                res.set_uri(active.link);
 
756
 
 
757
                                                res.set_title(active.title);
 
758
                                                //res.set_art(active.icon);
 
759
                                                // Set the rest of the attributes
 
760
                                                res.set_art("http://www.google.com/s2/favicons?domain=" + active.link);
 
761
                                                res["subtitle"] = active.author;
 
762
                                                res["date"] = active.publishedDate;
 
763
                                                res["description"] = active.content;
 
764
                                                // Push the result
 
765
                                                if (!reply->push(res)) {
 
766
                                                    // If we fail to push, it means the query has been cancelled.
 
767
                                                    // So don't continue;
 
768
                                                    return;
 
769
                                                }
 
770
                                                }
 
771
                                                }
 
772
                                            ///OMGS
 
773
                                            ///
 
774
 
 
775
                                         ///
 
776
 
 
777
 
 
778
                                        if (department == "Featured") { ///DEPARTMENT
 
779
                                                ///OMGS
 
780
                                                Client::Featureds featureds;
 
781
 
 
782
 
 
783
 
 
784
                                                // If there is no search string, get the
 
785
                                                featureds = client_.add_featureds("http://www.askubuntu.com/feeds/featured", lang_sys, rest_sys);
 
786
                                                // Register a category for the
 
787
                                                auto featured_cat = reply->register_category("Featured",
 
788
                                                                                             _("Featured"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
789
                                                // For each of the forecast days
 
790
                                                for (const auto &featured : featureds.featured) {
 
791
                                                    // Create a result
 
792
                                                    sc::CategorisedResult res(featured_cat);
 
793
 
 
794
                                                    // We must have a URI
 
795
                                                    res.set_uri(featured.link);
 
796
 
 
797
                                                    res.set_title(featured.title);
 
798
                                                    //res.set_art(featured.icon);
 
799
                                                    // Set the rest of the attributes
 
800
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + featured.link);
 
801
                                                    res["subtitle"] = featured.author;
 
802
                                                    res["date"] = featured.publishedDate;
 
803
                                                    res["description"] = featured.content;
 
804
                                                    // Push the result
 
805
                                                    if (!reply->push(res)) {
 
806
                                                        // If we fail to push, it means the query has been cancelled.
 
807
                                                        // So don't continue;
 
808
                                                        return;
 
809
                                                    }
 
810
                                                    }
 
811
                                                    }
 
812
                                                ///OMGS
 
813
 
 
814
 
 
815
                                        if (department == "Ask Ubuntu") { ///DEPARTMENT
 
816
                                                ///OMGS
 
817
                                                Client::Hots hots;
 
818
 
 
819
 
 
820
 
 
821
                                                // If there is no search string, get the
 
822
                                                hots = client_.add_hots("http://www.askubuntu.com/feeds/hot", lang_sys, rest_sys);
 
823
                                                // Register a category for the
 
824
                                                auto hot_cat = reply->register_category("Hot",
 
825
                                                                                             _("Hot"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
826
                                                // For each of the forecast days
 
827
                                                for (const auto &hot : hots.hot) {
 
828
                                                    // Create a result
 
829
                                                    sc::CategorisedResult res(hot_cat);
 
830
 
 
831
                                                    // We must have a URI
 
832
                                                    res.set_uri(hot.link);
 
833
 
 
834
                                                    res.set_title(hot.title);
 
835
                                                    //res.set_art(hot.icon);
 
836
                                                    // Set the rest of the attributes
 
837
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + hot.link);
 
838
                                                    res["subtitle"] = hot.author;
 
839
                                                    res["date"] = hot.publishedDate;
 
840
                                                    res["description"] = hot.content;
 
841
                                                    // Push the result
 
842
                                                    if (!reply->push(res)) {
 
843
                                                        // If we fail to push, it means the query has been cancelled.
 
844
                                                        // So don't continue;
 
845
                                                        return;
 
846
                                                    }
 
847
                                                    }
 
848
                                                    }
 
849
                                                ///OMGS
 
850
                                        if (department == "Ask Ubuntu") { ///DEPARTMENT
 
851
                                                ///OMGS
 
852
                                                Client::Weeklys weeklys;
 
853
 
 
854
 
 
855
 
 
856
                                                // If there is no search string, get the
 
857
                                                weeklys = client_.add_weeklys("http://www.askubuntu.com/feeds/week", lang_sys, rest_sys);
 
858
                                                // Register a category for the
 
859
                                                auto weekly_cat = reply->register_category("Weekly",
 
860
                                                                                             _("Weekly"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
861
                                                // For each of the forecast days
 
862
                                                for (const auto &weekly : weeklys.weekly) {
 
863
                                                    // Create a result
 
864
                                                    sc::CategorisedResult res(weekly_cat);
 
865
 
 
866
                                                    // We must have a URI
 
867
                                                    res.set_uri(weekly.link);
 
868
 
 
869
                                                    res.set_title(weekly.title);
 
870
                                                    //res.set_art(weekly.icon);
 
871
                                                    // Set the rest of the attributes
 
872
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + weekly.link);
 
873
                                                    res["subtitle"] = weekly.author;
 
874
                                                    res["date"] = weekly.publishedDate;
 
875
                                                    res["description"] = weekly.content;
 
876
                                                    // Push the result
 
877
                                                    if (!reply->push(res)) {
 
878
                                                        // If we fail to push, it means the query has been cancelled.
 
879
                                                        // So don't continue;
 
880
                                                        return;
 
881
                                                    }
 
882
                                                    }
 
883
                                                    }
 
884
                                                ///OMGS
 
885
                                        if (department == "Ask Ubuntu") { ///DEPARTMENT
 
886
                                                ///OMGS
 
887
                                                Client::Months months;
 
888
 
 
889
 
 
890
 
 
891
                                                // If there is no search string, get the
 
892
                                                months = client_.add_months("http://www.askubuntu.com/feeds/month", lang_sys, rest_sys);
 
893
                                                // Register a category for the
 
894
                                                auto month_cat = reply->register_category("Month",
 
895
                                                                                             _("Monthly"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
896
                                                // For each of the forecast days
 
897
                                                for (const auto &month : months.month) {
 
898
                                                    // Create a result
 
899
                                                    sc::CategorisedResult res(month_cat);
 
900
 
 
901
                                                    // We must have a URI
 
902
                                                    res.set_uri(month.link);
 
903
 
 
904
                                                    res.set_title(month.title);
 
905
                                                    //res.set_art(month.icon);
 
906
                                                    // Set the rest of the attributes
 
907
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + month.link);
 
908
                                                    res["subtitle"] = month.author;
 
909
                                                    res["date"] = month.publishedDate;
 
910
                                                    res["description"] = month.content;
 
911
                                                    // Push the result
 
912
                                                    if (!reply->push(res)) {
 
913
                                                        // If we fail to push, it means the query has been cancelled.
 
914
                                                        // So don't continue;
 
915
                                                        return;
 
916
                                                    }
 
917
                                                    }
 
918
                                                    }
 
919
                                                ///OMGS
 
920
                                                ///
 
921
                                                ///
 
922
                                                /// TAAAAAAAAAAAAAAGGGGGGGGGGGSSSSSSSSSSSSSSSSSSSSSS
 
923
                                                /// ////////////////////
 
924
                                                /// ///////////
 
925
                                                /// /
 
926
                                                /// //
 
927
                                                /// /
 
928
                                                /// /
 
929
 
 
930
                                        if (department == "Installation") { ///DEPARTMENT
 
931
                                                ///OMGS
 
932
                                                Client::Installations installations;
 
933
 
 
934
 
 
935
 
 
936
                                                // If there is no search string, get the
 
937
                                                installations = client_.add_installations("http://www.askubuntu.com/feeds/tag/installation", lang_sys, rest_sys);
 
938
                                                // Register a category for the
 
939
                                                auto installation_cat = reply->register_category("Installation",
 
940
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
941
                                                // For each of the forecast days
 
942
                                                for (const auto &installation : installations.installation) {
 
943
                                                    // Create a result
 
944
                                                    sc::CategorisedResult res(installation_cat);
 
945
 
 
946
                                                    // We must have a URI
 
947
                                                    res.set_uri(installation.link);
 
948
 
 
949
                                                    res.set_title(installation.title);
 
950
                                                    //res.set_art(installation.icon);
 
951
                                                    // Set the rest of the attributes
 
952
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + installation.link);
 
953
                                                    res["subtitle"] = installation.author;
 
954
                                                    res["date"] = installation.publishedDate;
 
955
                                                    res["description"] = installation.content;
 
956
                                                    // Push the result
 
957
                                                    if (!reply->push(res)) {
 
958
                                                        // If we fail to push, it means the query has been cancelled.
 
959
                                                        // So don't continue;
 
960
                                                        return;
 
961
                                                    }
 
962
                                                    }
 
963
                                                    }
 
964
                                                ///OMGS
 
965
                                                ///
 
966
 
 
967
                                        if (department == "Boot") { ///DEPARTMENT
 
968
                                                ///OMGS
 
969
                                                Client::Boots boots;
 
970
 
 
971
 
 
972
 
 
973
                                                // If there is no search string, get the
 
974
                                                boots = client_.add_boots("http://www.askubuntu.com/feeds/tag/boot", lang_sys, rest_sys);
 
975
                                                // Register a category for the
 
976
                                                auto boot_cat = reply->register_category("Boot",
 
977
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
978
                                                // For each of the forecast days
 
979
                                                for (const auto &boot : boots.boot) {
 
980
                                                    // Create a result
 
981
                                                    sc::CategorisedResult res(boot_cat);
 
982
 
 
983
                                                    // We must have a URI
 
984
                                                    res.set_uri(boot.link);
 
985
 
 
986
                                                    res.set_title(boot.title);
 
987
                                                    //res.set_art(boot.icon);
 
988
                                                    // Set the rest of the attributes
 
989
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + boot.link);
 
990
                                                    res["subtitle"] = boot.author;
 
991
                                                    res["date"] = boot.publishedDate;
 
992
                                                    res["description"] = boot.content;
 
993
                                                    // Push the result
 
994
                                                    if (!reply->push(res)) {
 
995
                                                        // If we fail to push, it means the query has been cancelled.
 
996
                                                        // So don't continue;
 
997
                                                        return;
 
998
                                                    }
 
999
                                                    }
 
1000
                                                    }
 
1001
                                                ///OMGS
 
1002
                                                ///
 
1003
 
 
1004
                                        if (department == "Unity") { ///DEPARTMENT
 
1005
                                                ///OMGS
 
1006
                                                Client::Unitys unitys;
 
1007
 
 
1008
 
 
1009
 
 
1010
                                                // If there is no search string, get the
 
1011
                                                unitys = client_.add_unitys("http://www.askubuntu.com/feeds/tag/unity", lang_sys, rest_sys);
 
1012
                                                // Register a category for the
 
1013
                                                auto unity_cat = reply->register_category("Unity",
 
1014
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1015
                                                // For each of the forecast days
 
1016
                                                for (const auto &unity : unitys.unity) {
 
1017
                                                    // Create a result
 
1018
                                                    sc::CategorisedResult res(unity_cat);
 
1019
 
 
1020
                                                    // We must have a URI
 
1021
                                                    res.set_uri(unity.link);
 
1022
 
 
1023
                                                    res.set_title(unity.title);
 
1024
                                                    //res.set_art(unity.icon);
 
1025
                                                    // Set the rest of the attributes
 
1026
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + unity.link);
 
1027
                                                    res["subtitle"] = unity.author;
 
1028
                                                    res["date"] = unity.publishedDate;
 
1029
                                                    res["description"] = unity.content;
 
1030
                                                    // Push the result
 
1031
                                                    if (!reply->push(res)) {
 
1032
                                                        // If we fail to push, it means the query has been cancelled.
 
1033
                                                        // So don't continue;
 
1034
                                                        return;
 
1035
                                                    }
 
1036
                                                    }
 
1037
                                                    }
 
1038
                                                ///OMGS
 
1039
                                        if (department == "Wireless") { ///DEPARTMENT
 
1040
                                                ///OMGS
 
1041
                                                Client::Wirelesss wirelesss;
 
1042
 
 
1043
 
 
1044
 
 
1045
                                                // If there is no search string, get the
 
1046
                                                wirelesss = client_.add_wirelesss("http://www.askubuntu.com/feeds/tag/wireless", lang_sys, rest_sys);
 
1047
                                                // Register a category for the
 
1048
                                                auto wireless_cat = reply->register_category("Wireless",
 
1049
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1050
                                                // For each of the forecast days
 
1051
                                                for (const auto &wireless : wirelesss.wireless) {
 
1052
                                                    // Create a result
 
1053
                                                    sc::CategorisedResult res(wireless_cat);
 
1054
 
 
1055
                                                    // We must have a URI
 
1056
                                                    res.set_uri(wireless.link);
 
1057
 
 
1058
                                                    res.set_title(wireless.title);
 
1059
                                                    //res.set_art(wireless.icon);
 
1060
                                                    // Set the rest of the attributes
 
1061
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + wireless.link);
 
1062
                                                    res["subtitle"] = wireless.author;
 
1063
                                                    res["date"] = wireless.publishedDate;
 
1064
                                                    res["description"] = wireless.content;
 
1065
                                                    // Push the result
 
1066
                                                    if (!reply->push(res)) {
 
1067
                                                        // If we fail to push, it means the query has been cancelled.
 
1068
                                                        // So don't continue;
 
1069
                                                        return;
 
1070
                                                    }
 
1071
                                                    }
 
1072
                                                    }
 
1073
                                                ///OMGS
 
1074
                                        if (department == "Networking") { ///DEPARTMENT
 
1075
                                                ///OMGS
 
1076
                                                Client::Networkings networkings;
 
1077
 
 
1078
 
 
1079
 
 
1080
                                                // If there is no search string, get the
 
1081
                                                networkings = client_.add_networkings("http://www.askubuntu.com/feeds/tag/networking", lang_sys, rest_sys);
 
1082
                                                // Register a category for the
 
1083
                                                auto networking_cat = reply->register_category("Networking",
 
1084
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1085
                                                // For each of the forecast days
 
1086
                                                for (const auto &networking : networkings.networking) {
 
1087
                                                    // Create a result
 
1088
                                                    sc::CategorisedResult res(networking_cat);
 
1089
 
 
1090
                                                    // We must have a URI
 
1091
                                                    res.set_uri(networking.link);
 
1092
 
 
1093
                                                    res.set_title(networking.title);
 
1094
                                                    //res.set_art(networking.icon);
 
1095
                                                    // Set the rest of the attributes
 
1096
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + networking.link);
 
1097
                                                    res["subtitle"] = networking.author;
 
1098
                                                    res["date"] = networking.publishedDate;
 
1099
                                                    res["description"] = networking.content;
 
1100
                                                    // Push the result
 
1101
                                                    if (!reply->push(res)) {
 
1102
                                                        // If we fail to push, it means the query has been cancelled.
 
1103
                                                        // So don't continue;
 
1104
                                                        return;
 
1105
                                                    }
 
1106
                                                    }
 
1107
                                                    }
 
1108
                                                ///OMGS
 
1109
                                        if (department == "Command Line") { ///DEPARTMENT
 
1110
                                                ///OMGS
 
1111
                                                Client::Commandlines commandlines;
 
1112
 
 
1113
 
 
1114
 
 
1115
                                                // If there is no search string, get the
 
1116
                                                commandlines = client_.add_commandlines("http://www.askubuntu.com/feeds/tag/command-line", lang_sys, rest_sys);
 
1117
                                                // Register a category for the
 
1118
                                                auto commandline_cat = reply->register_category("Command Line",
 
1119
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1120
                                                // For each of the forecast days
 
1121
                                                for (const auto &commandline : commandlines.commandline) {
 
1122
                                                    // Create a result
 
1123
                                                    sc::CategorisedResult res(commandline_cat);
 
1124
 
 
1125
                                                    // We must have a URI
 
1126
                                                    res.set_uri(commandline.link);
 
1127
 
 
1128
                                                    res.set_title(commandline.title);
 
1129
                                                    //res.set_art(commandline.icon);
 
1130
                                                    // Set the rest of the attributes
 
1131
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + commandline.link);
 
1132
                                                    res["subtitle"] = commandline.author;
 
1133
                                                    res["date"] = commandline.publishedDate;
 
1134
                                                    res["description"] = commandline.content;
 
1135
                                                    // Push the result
 
1136
                                                    if (!reply->push(res)) {
 
1137
                                                        // If we fail to push, it means the query has been cancelled.
 
1138
                                                        // So don't continue;
 
1139
                                                        return;
 
1140
                                                    }
 
1141
                                                    }
 
1142
                                                    }
 
1143
                                                ///OMGS
 
1144
                                        if (department == "Dual Boot") { ///DEPARTMENT
 
1145
                                                ///OMGS
 
1146
                                                Client::Dualboots dualboots;
 
1147
 
 
1148
 
 
1149
 
 
1150
                                                // If there is no search string, get the
 
1151
                                                dualboots = client_.add_dualboots("http://www.askubuntu.com/feeds/tag/dual-boot", lang_sys, rest_sys);
 
1152
                                                // Register a category for the
 
1153
                                                auto dualboot_cat = reply->register_category("Dualboot",
 
1154
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1155
                                                // For each of the forecast days
 
1156
                                                for (const auto &dualboot : dualboots.dualboot) {
 
1157
                                                    // Create a result
 
1158
                                                    sc::CategorisedResult res(dualboot_cat);
 
1159
 
 
1160
                                                    // We must have a URI
 
1161
                                                    res.set_uri(dualboot.link);
 
1162
 
 
1163
                                                    res.set_title(dualboot.title);
 
1164
                                                    //res.set_art(dualboot.icon);
 
1165
                                                    // Set the rest of the attributes
 
1166
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + dualboot.link);
 
1167
                                                    res["subtitle"] = dualboot.author;
 
1168
                                                    res["date"] = dualboot.publishedDate;
 
1169
                                                    res["description"] = dualboot.content;
 
1170
                                                    // Push the result
 
1171
                                                    if (!reply->push(res)) {
 
1172
                                                        // If we fail to push, it means the query has been cancelled.
 
1173
                                                        // So don't continue;
 
1174
                                                        return;
 
1175
                                                    }
 
1176
                                                    }
 
1177
                                                    }
 
1178
                                                ///OMGS
 
1179
                                        if (department == "Drivers") { ///DEPARTMENT
 
1180
                                                ///OMGS
 
1181
                                                Client::Drivers drivers;
 
1182
 
 
1183
 
 
1184
 
 
1185
                                                // If there is no search string, get the
 
1186
                                                drivers = client_.add_drivers("http://www.askubuntu.com/feeds/tag/drivers", lang_sys, rest_sys);
 
1187
                                                // Register a category for the
 
1188
                                                auto driver_cat = reply->register_category("Drivers",
 
1189
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1190
                                                // For each of the forecast days
 
1191
                                                for (const auto &driver : drivers.driver) {
 
1192
                                                    // Create a result
 
1193
                                                    sc::CategorisedResult res(driver_cat);
 
1194
 
 
1195
                                                    // We must have a URI
 
1196
                                                    res.set_uri(driver.link);
 
1197
 
 
1198
                                                    res.set_title(driver.title);
 
1199
                                                    //res.set_art(driver.icon);
 
1200
                                                    // Set the rest of the attributes
 
1201
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + driver.link);
 
1202
                                                    res["subtitle"] = driver.author;
 
1203
                                                    res["date"] = driver.publishedDate;
 
1204
                                                    res["description"] = driver.content;
 
1205
                                                    // Push the result
 
1206
                                                    if (!reply->push(res)) {
 
1207
                                                        // If we fail to push, it means the query has been cancelled.
 
1208
                                                        // So don't continue;
 
1209
                                                        return;
 
1210
                                                    }
 
1211
                                                    }
 
1212
                                                    }
 
1213
                                                ///OMGS
 
1214
                                        if (department == "Server") { ///DEPARTMENT
 
1215
                                                ///OMGS
 
1216
                                                Client::Servers servers;
 
1217
 
 
1218
 
 
1219
 
 
1220
                                                // If there is no search string, get the
 
1221
                                                servers = client_.add_servers("http://www.askubuntu.com/feeds/tag/server", lang_sys, rest_sys);
 
1222
                                                // Register a category for the
 
1223
                                                auto server_cat = reply->register_category("Server",
 
1224
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1225
                                                // For each of the forecast days
 
1226
                                                for (const auto &server : servers.server) {
 
1227
                                                    // Create a result
 
1228
                                                    sc::CategorisedResult res(server_cat);
 
1229
 
 
1230
                                                    // We must have a URI
 
1231
                                                    res.set_uri(server.link);
 
1232
 
 
1233
                                                    res.set_title(server.title);
 
1234
                                                    //res.set_art(server.icon);
 
1235
                                                    // Set the rest of the attributes
 
1236
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + server.link);
 
1237
                                                    res["subtitle"] = server.author;
 
1238
                                                    res["date"] = server.publishedDate;
 
1239
                                                    res["description"] = server.content;
 
1240
                                                    // Push the result
 
1241
                                                    if (!reply->push(res)) {
 
1242
                                                        // If we fail to push, it means the query has been cancelled.
 
1243
                                                        // So don't continue;
 
1244
                                                        return;
 
1245
                                                    }
 
1246
                                                    }
 
1247
                                                    }
 
1248
                                                ///OMGS
 
1249
                                        if (department == "Grub2") { ///DEPARTMENT
 
1250
                                                ///OMGS
 
1251
                                                Client::Grub2s grub2s;
 
1252
 
 
1253
 
 
1254
 
 
1255
                                                // If there is no search string, get the
 
1256
                                                grub2s = client_.add_grub2s("http://www.askubuntu.com/feeds/tag/grub2", lang_sys, rest_sys);
 
1257
                                                // Register a category for the
 
1258
                                                auto grub2_cat = reply->register_category("Grub2",
 
1259
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1260
                                                // For each of the forecast days
 
1261
                                                for (const auto &grub2 : grub2s.grub2) {
 
1262
                                                    // Create a result
 
1263
                                                    sc::CategorisedResult res(grub2_cat);
 
1264
 
 
1265
                                                    // We must have a URI
 
1266
                                                    res.set_uri(grub2.link);
 
1267
 
 
1268
                                                    res.set_title(grub2.title);
 
1269
                                                    //res.set_art(grub2.icon);
 
1270
                                                    // Set the rest of the attributes
 
1271
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + grub2.link);
 
1272
                                                    res["subtitle"] = grub2.author;
 
1273
                                                    res["date"] = grub2.publishedDate;
 
1274
                                                    res["description"] = grub2.content;
 
1275
                                                    // Push the result
 
1276
                                                    if (!reply->push(res)) {
 
1277
                                                        // If we fail to push, it means the query has been cancelled.
 
1278
                                                        // So don't continue;
 
1279
                                                        return;
 
1280
                                                    }
 
1281
                                                    }
 
1282
                                                    }
 
1283
                                                ///OMGS
 
1284
                                        if (department == "Apt") { ///DEPARTMENT
 
1285
                                                ///OMGS
 
1286
                                                Client::Apts apts;
 
1287
 
 
1288
 
 
1289
 
 
1290
                                                // If there is no search string, get the
 
1291
                                                apts = client_.add_apts("http://www.askubuntu.com/feeds/tag/apt", lang_sys, rest_sys);
 
1292
                                                // Register a category for the
 
1293
                                                auto apt_cat = reply->register_category("Apt",
 
1294
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1295
                                                // For each of the forecast days
 
1296
                                                for (const auto &apt : apts.apt) {
 
1297
                                                    // Create a result
 
1298
                                                    sc::CategorisedResult res(apt_cat);
 
1299
 
 
1300
                                                    // We must have a URI
 
1301
                                                    res.set_uri(apt.link);
 
1302
 
 
1303
                                                    res.set_title(apt.title);
 
1304
                                                    //res.set_art(apt.icon);
 
1305
                                                    // Set the rest of the attributes
 
1306
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + apt.link);
 
1307
                                                    res["subtitle"] = apt.author;
 
1308
                                                    res["date"] = apt.publishedDate;
 
1309
                                                    res["description"] = apt.content;
 
1310
                                                    // Push the result
 
1311
                                                    if (!reply->push(res)) {
 
1312
                                                        // If we fail to push, it means the query has been cancelled.
 
1313
                                                        // So don't continue;
 
1314
                                                        return;
 
1315
                                                    }
 
1316
                                                    }
 
1317
                                                    }
 
1318
                                                ///OMGS
 
1319
                                        if (department == "Gnome") { ///DEPARTMENT
 
1320
                                                ///OMGS
 
1321
                                                Client::Gnomes gnomes;
 
1322
 
 
1323
 
 
1324
 
 
1325
                                                // If there is no search string, get the
 
1326
                                                gnomes = client_.add_gnomes("http://www.askubuntu.com/feeds/tag/gnome", lang_sys, rest_sys);
 
1327
                                                // Register a category for the
 
1328
                                                auto gnome_cat = reply->register_category("Gnome",
 
1329
                                                                                             _("Tagged Gnome"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1330
                                                // For each of the forecast days
 
1331
                                                for (const auto &gnome : gnomes.gnome) {
 
1332
                                                    // Create a result
 
1333
                                                    sc::CategorisedResult res(gnome_cat);
 
1334
 
 
1335
                                                    // We must have a URI
 
1336
                                                    res.set_uri(gnome.link);
 
1337
 
 
1338
                                                    res.set_title(gnome.title);
 
1339
                                                    //res.set_art(gnome.icon);
 
1340
                                                    // Set the rest of the attributes
 
1341
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + gnome.link);
 
1342
                                                    res["subtitle"] = gnome.author;
 
1343
                                                    res["date"] = gnome.publishedDate;
 
1344
                                                    res["description"] = gnome.content;
 
1345
                                                    // Push the result
 
1346
                                                    if (!reply->push(res)) {
 
1347
                                                        // If we fail to push, it means the query has been cancelled.
 
1348
                                                        // So don't continue;
 
1349
                                                        return;
 
1350
                                                    }
 
1351
                                                    }
 
1352
                                                    }
 
1353
                                                ///OMGS
 
1354
                                        if (department == "Partitioning") { ///DEPARTMENT
 
1355
                                                ///OMGS
 
1356
                                                Client::Partitionings partitionings;
 
1357
 
 
1358
 
 
1359
 
 
1360
                                                // If there is no search string, get the
 
1361
                                                partitionings = client_.add_partitionings("http://www.askubuntu.com/feeds/tag/partitioning", lang_sys, rest_sys);
 
1362
                                                // Register a category for the
 
1363
                                                auto partitioning_cat = reply->register_category("Partitioning",
 
1364
                                                                                             _("Tagged Partitioning"), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1365
                                                // For each of the forecast days
 
1366
                                                for (const auto &partitioning : partitionings.partitioning) {
 
1367
                                                    // Create a result
 
1368
                                                    sc::CategorisedResult res(partitioning_cat);
 
1369
 
 
1370
                                                    // We must have a URI
 
1371
                                                    res.set_uri(partitioning.link);
 
1372
 
 
1373
                                                    res.set_title(partitioning.title);
 
1374
                                                    //res.set_art(partitioning.icon);
 
1375
                                                    // Set the rest of the attributes
 
1376
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + partitioning.link);
 
1377
                                                    res["subtitle"] = partitioning.author;
 
1378
                                                    res["date"] = partitioning.publishedDate;
 
1379
                                                    res["description"] = partitioning.content;
 
1380
                                                    // Push the result
 
1381
                                                    if (!reply->push(res)) {
 
1382
                                                        // If we fail to push, it means the query has been cancelled.
 
1383
                                                        // So don't continue;
 
1384
                                                        return;
 
1385
                                                    }
 
1386
                                                    }
 
1387
                                                    }
 
1388
                                                ///OMGS
 
1389
                                        if (department == "NVIDIA") { ///DEPARTMENT
 
1390
                                                ///OMGS
 
1391
                                                Client::Nvidias nvidias;
 
1392
 
 
1393
 
 
1394
 
 
1395
                                                // If there is no search string, get the
 
1396
                                                nvidias = client_.add_nvidias("http://www.askubuntu.com/feeds/tag/nvidia", lang_sys, rest_sys);
 
1397
                                                // Register a category for the
 
1398
                                                auto nvidia_cat = reply->register_category("Nvidia",
 
1399
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1400
                                                // For each of the forecast days
 
1401
                                                for (const auto &nvidia : nvidias.nvidia) {
 
1402
                                                    // Create a result
 
1403
                                                    sc::CategorisedResult res(nvidia_cat);
 
1404
 
 
1405
                                                    // We must have a URI
 
1406
                                                    res.set_uri(nvidia.link);
 
1407
 
 
1408
                                                    res.set_title(nvidia.title);
 
1409
                                                    //res.set_art(nvidia.icon);
 
1410
                                                    // Set the rest of the attributes
 
1411
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + nvidia.link);
 
1412
                                                    res["subtitle"] = nvidia.author;
 
1413
                                                    res["date"] = nvidia.publishedDate;
 
1414
                                                    res["description"] = nvidia.content;
 
1415
                                                    // Push the result
 
1416
                                                    if (!reply->push(res)) {
 
1417
                                                        // If we fail to push, it means the query has been cancelled.
 
1418
                                                        // So don't continue;
 
1419
                                                        return;
 
1420
                                                    }
 
1421
                                                    }
 
1422
                                                    }
 
1423
                                                ///OMGS
 
1424
                                        if (department == "ATI") { ///DEPARTMENT
 
1425
                                                ///OMGS
 
1426
                                                Client::Atis atis;
 
1427
 
 
1428
 
 
1429
 
 
1430
                                                // If there is no search string, get the
 
1431
                                                atis = client_.add_atis("http://www.askubuntu.com/feeds/tag/ati", lang_sys, rest_sys);
 
1432
                                                // Register a category for the
 
1433
                                                auto ati_cat = reply->register_category("Ati",
 
1434
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1435
                                                // For each of the forecast days
 
1436
                                                for (const auto &ati : atis.ati) {
 
1437
                                                    // Create a result
 
1438
                                                    sc::CategorisedResult res(ati_cat);
 
1439
 
 
1440
                                                    // We must have a URI
 
1441
                                                    res.set_uri(ati.link);
 
1442
 
 
1443
                                                    res.set_title(ati.title);
 
1444
                                                    //res.set_art(ati.icon);
 
1445
                                                    // Set the rest of the attributes
 
1446
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + ati.link);
 
1447
                                                    res["subtitle"] = ati.author;
 
1448
                                                    res["date"] = ati.publishedDate;
 
1449
                                                    res["description"] = ati.content;
 
1450
                                                    // Push the result
 
1451
                                                    if (!reply->push(res)) {
 
1452
                                                        // If we fail to push, it means the query has been cancelled.
 
1453
                                                        // So don't continue;
 
1454
                                                        return;
 
1455
                                                    }
 
1456
                                                    }
 
1457
                                                    }
 
1458
                                                ///OMGS
 
1459
                                        if (department == "Upgrade") { ///DEPARTMENT
 
1460
                                                ///OMGS
 
1461
                                                Client::Upgrades upgrades;
 
1462
 
 
1463
 
 
1464
 
 
1465
                                                // If there is no search string, get the
 
1466
                                                upgrades = client_.add_upgrades("http://www.askubuntu.com/feeds/tag/upgrade", lang_sys, rest_sys);
 
1467
                                                // Register a category for the
 
1468
                                                auto upgrade_cat = reply->register_category("Upgrade",
 
1469
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1470
                                                // For each of the forecast days
 
1471
                                                for (const auto &upgrade : upgrades.upgrade) {
 
1472
                                                    // Create a result
 
1473
                                                    sc::CategorisedResult res(upgrade_cat);
 
1474
 
 
1475
                                                    // We must have a URI
 
1476
                                                    res.set_uri(upgrade.link);
 
1477
 
 
1478
                                                    res.set_title(upgrade.title);
 
1479
                                                    //res.set_art(upgrade.icon);
 
1480
                                                    // Set the rest of the attributes
 
1481
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + upgrade.link);
 
1482
                                                    res["subtitle"] = upgrade.author;
 
1483
                                                    res["date"] = upgrade.publishedDate;
 
1484
                                                    res["description"] = upgrade.content;
 
1485
                                                    // Push the result
 
1486
                                                    if (!reply->push(res)) {
 
1487
                                                        // If we fail to push, it means the query has been cancelled.
 
1488
                                                        // So don't continue;
 
1489
                                                        return;
 
1490
                                                    }
 
1491
                                                    }
 
1492
                                                    }
 
1493
                                                ///OMGS
 
1494
                                        if (department == "Sound") { ///DEPARTMENT
 
1495
                                                ///OMGS
 
1496
                                                Client::Sounds sounds;
 
1497
 
 
1498
 
 
1499
 
 
1500
                                                // If there is no search string, get the
 
1501
                                                sounds = client_.add_sounds("http://www.askubuntu.com/feeds/tag/sound", lang_sys, rest_sys);
 
1502
                                                // Register a category for the
 
1503
                                                auto sound_cat = reply->register_category("Sound",
 
1504
                                                                                             _(""), "", sc::CategoryRenderer(LAUNCH_TEMPLATE));
 
1505
                                                // For each of the forecast days
 
1506
                                                for (const auto &sound : sounds.sound) {
 
1507
                                                    // Create a result
 
1508
                                                    sc::CategorisedResult res(sound_cat);
 
1509
 
 
1510
                                                    // We must have a URI
 
1511
                                                    res.set_uri(sound.link);
 
1512
 
 
1513
                                                    res.set_title(sound.title);
 
1514
                                                    //res.set_art(sound.icon);
 
1515
                                                    // Set the rest of the attributes
 
1516
                                                    res.set_art("http://www.google.com/s2/favicons?domain=" + sound.link);
 
1517
                                                    res["subtitle"] = sound.author;
 
1518
                                                    res["date"] = sound.publishedDate;
 
1519
                                                    res["description"] = sound.content;
 
1520
                                                    // Push the result
 
1521
                                                    if (!reply->push(res)) {
 
1522
                                                        // If we fail to push, it means the query has been cancelled.
 
1523
                                                        // So don't continue;
 
1524
                                                        return;
 
1525
                                                    }
 
1526
                                                    }
 
1527
                                                    }
 
1528
                                                ///OMGS
 
1529
 
 
1530
 
643
1531
 
644
1532
    } catch (domain_error &e) {
645
1533
        // Handle exceptions being thrown by the client API