| | 103 | { "INFO", &CRMSClient::Process_INFO, |
| | 104 | "Print out user information. Argument is the uin, or none for personal." }, |
| | 105 | { "LIST", &CRMSClient::Process_LIST, |
| | 106 | "List users { [ <group #> ] [ <online|offline|all> ] [ <format> ] }." }, |
| | 107 | { "LOG", &CRMSClient::Process_LOG, |
| | 108 | "Dump log messages { <log types> }." }, |
| | 109 | { "MESSAGE", &CRMSClient::Process_MESSAGE, |
| | 110 | "Send a message { <uin> }." }, |
| | 113 | { "REMUSER", &CRMSClient::Process_REMUSER, |
| | 114 | "Remove user from contact list { <uin> }." }, |
| | 115 | { "SECURE", &CRMSClient::Process_SECURE, |
| | 116 | "Open/close/check secure channel { <uin> [ <open|close> ] } ." }, |
| | 117 | { "STATUS", &CRMSClient::Process_STATUS, |
| | 118 | "Set or show status. Argument is new status, or blank to display current." }, |
| 94 | | { "INFO", &CRMSClient::Process_INFO, |
| 95 | | "Print out user information. Argument is the uin, or none for personal." }, |
| 96 | | { "STATUS", &CRMSClient::Process_STATUS, |
| 97 | | "Set or show status. Argument is new status, or blank to display current." }, |
| 98 | | { "GROUPS", &CRMSClient::Process_GROUPS, |
| 99 | | "Show list of groups." }, |
| 100 | | { "LIST", &CRMSClient::Process_LIST, |
| 101 | | "List users { [ <group #> ] [ <online|offline|all> ] [ <format> ] }." }, |
| 102 | | { "MESSAGE", &CRMSClient::Process_MESSAGE, |
| 103 | | "Send a message { <uin> }." }, |
| 104 | | { "URL", &CRMSClient::Process_URL, |
| 105 | | "Send a url { <uin> }." }, |
| 106 | | { "LOG", &CRMSClient::Process_LOG, |
| 107 | | "Dump log messages { <log types> }." }, |
| 1136 | | |
| | 1149 | /*--------------------------------------------------------------------------- |
| | 1150 | * CRMSClient::Process_ADDUSER |
| | 1151 | * |
| | 1152 | * Command: |
| | 1153 | * ADDUSER <uin> |
| | 1154 | * |
| | 1155 | * Response: |
| | 1156 | * |
| | 1157 | *-------------------------------------------------------------------------*/ |
| | 1158 | int CRMSClient::Process_ADDUSER() |
| | 1159 | { |
| | 1160 | unsigned long nUin = atol(data_arg); |
| | 1161 | |
| | 1162 | if (nUin >= 10000) |
| | 1163 | { |
| | 1164 | if (licqDaemon->AddUserToList(nUin)) |
| | 1165 | { |
| | 1166 | fprintf(fs, "%d User added\n", CODE_ADDUSERxDONE); |
| | 1167 | } |
| | 1168 | else |
| | 1169 | { |
| | 1170 | fprintf(fs, "%d User not added\n", CODE_ADDUSERxERROR); |
| | 1171 | } |
| | 1172 | } |
| | 1173 | else |
| | 1174 | { |
| | 1175 | fprintf(fs, "%d Invalid UIN.\n", CODE_INVALIDxUSER); |
| | 1176 | } |
| | 1177 | |
| | 1178 | return fflush(fs); |
| | 1179 | } |
| | 1180 | |
| | 1181 | /*--------------------------------------------------------------------------- |
| | 1182 | * CRMSClient::Process_REMUSER |
| | 1183 | * |
| | 1184 | * Command: |
| | 1185 | * REMUSER <uin> |
| | 1186 | * |
| | 1187 | * Response: |
| | 1188 | * |
| | 1189 | *-------------------------------------------------------------------------*/ |
| | 1190 | int CRMSClient::Process_REMUSER() |
| | 1191 | { |
| | 1192 | unsigned long nUin = atol(data_arg); |
| | 1193 | |
| | 1194 | if (nUin >= 10000) |
| | 1195 | { |
| | 1196 | licqDaemon->RemoveUserFromList(nUin); |
| | 1197 | fprintf(fs, "%d User removed\n", CODE_REMUSERxDONE); |
| | 1198 | } |
| | 1199 | else |
| | 1200 | { |
| | 1201 | fprintf(fs, "%d Invalid UIN.\n", CODE_INVALIDxUSER); |
| | 1202 | } |
| | 1203 | |
| | 1204 | return fflush(fs); |
| | 1205 | } |
| | 1206 | |
| | 1207 | /*--------------------------------------------------------------------------- |
| | 1208 | * CRMSClient::Process_SECURE |
| | 1209 | * |
| | 1210 | * Command: |
| | 1211 | * SECURE <uin> <what> |
| | 1212 | * |
| | 1213 | * Response: |
| | 1214 | * |
| | 1215 | *-------------------------------------------------------------------------*/ |
| | 1216 | int CRMSClient::Process_SECURE() |
| | 1217 | { |
| | 1218 | unsigned long nUin = 0; |
| | 1219 | |
| | 1220 | if(!licqDaemon->CryptoEnabled()) |
| | 1221 | { |
| | 1222 | fprintf(fs, "%d Licq secure channel not compiled. Please recompile with OpenSSL.\n", CODE_SECURExNOTCOMPILED); |
| | 1223 | return fflush(fs); |
| | 1224 | } |
| | 1225 | |
| | 1226 | |
| | 1227 | if (isdigit(*data_arg)) |
| | 1228 | { |
| | 1229 | nUin = atol(data_arg); |
| | 1230 | while (*data_arg != '\0' && *data_arg != ' ') data_arg++; |
| | 1231 | NEXT_WORD(data_arg); |
| | 1232 | } |
| | 1233 | else |
| | 1234 | { |
| | 1235 | fprintf(fs, "%d Invalid UIN.\n", CODE_INVALIDxUSER); |
| | 1236 | return fflush(fs); |
| | 1237 | } |
| | 1238 | |
| | 1239 | if (nUin < 10000) |
| | 1240 | { |
| | 1241 | fprintf(fs, "%d Invalid UIN.\n", CODE_INVALIDxUSER); |
| | 1242 | return fflush(fs); |
| | 1243 | } |
| | 1244 | |
| | 1245 | if (strncasecmp(data_arg, "open", 4) == 0) |
| | 1246 | { |
| | 1247 | fprintf(fs, "%d Opening secure connection.\n", CODE_SECURExOPEN); |
| | 1248 | licqDaemon->icqOpenSecureChannel(nUin); |
| | 1249 | } |
| | 1250 | else |
| | 1251 | if (strncasecmp(data_arg, "close", 5) == 0) |
| | 1252 | { |
| | 1253 | fprintf(fs, "%d Closing secure connection.\n", CODE_SECURExCLOSE); |
| | 1254 | licqDaemon->icqCloseSecureChannel(nUin); |
| | 1255 | } |
| | 1256 | else |
| | 1257 | { |
| | 1258 | ICQUser *u = gUserManager.FetchUser(nUin,LOCK_R); |
| | 1259 | if (u->Secure() == 0) |
| | 1260 | { |
| | 1261 | fprintf(fs, "%d Status: secure connection is closed.\n", CODE_SECURExSTAT); |
| | 1262 | } |
| | 1263 | if (u->Secure() == 1) |
| | 1264 | { |
| | 1265 | fprintf(fs, "%d Status: secure connection is open.\n", CODE_SECURExSTAT); |
| | 1266 | } |
| | 1267 | gUserManager.DropUser(u); |
| | 1268 | } |
| | 1269 | |
| | 1270 | return fflush(fs); |
| | 1271 | } |