|
@@ -50,6 +50,7 @@ int do_cmd_currs(char *);
|
|
|
int do_cmd_swtch(char *);
|
|
int do_cmd_swtch(char *);
|
|
|
int do_cmd_lsse(char *);
|
|
int do_cmd_lsse(char *);
|
|
|
int do_cmd_uinfo(char *);
|
|
int do_cmd_uinfo(char *);
|
|
|
|
|
+int do_cmd_lself(char *);
|
|
|
|
|
|
|
|
int read_msg(struct vcc_request *);
|
|
int read_msg(struct vcc_request *);
|
|
|
int vcc_create_session(char *name);
|
|
int vcc_create_session(char *name);
|
|
@@ -59,6 +60,7 @@ int do_cmd_ls_bh(struct vcc_request *);
|
|
|
extern char usrname[];
|
|
extern char usrname[];
|
|
|
extern int rate;
|
|
extern int rate;
|
|
|
extern int current_sid;
|
|
extern int current_sid;
|
|
|
|
|
+extern int self_level;
|
|
|
|
|
|
|
|
int get_users(void);
|
|
int get_users(void);
|
|
|
int get_sessions(void);
|
|
int get_sessions(void);
|
|
@@ -78,6 +80,7 @@ struct cmdtable {
|
|
|
{ "-swtch", do_cmd_swtch, "Switch to another session. " },
|
|
{ "-swtch", do_cmd_swtch, "Switch to another session. " },
|
|
|
{ "-lsse", do_cmd_lsse, "List all sessions created. " },
|
|
{ "-lsse", do_cmd_lsse, "List all sessions created. " },
|
|
|
{ "-uinfo", do_cmd_uinfo, "Get one's information. " },
|
|
{ "-uinfo", do_cmd_uinfo, "Get one's information. " },
|
|
|
|
|
+ { "-lself", do_cmd_lself, "Reload information of myself. " },
|
|
|
|
|
|
|
|
{ NULL, NULL, NULL }
|
|
{ NULL, NULL, NULL }
|
|
|
};
|
|
};
|
|
@@ -259,15 +262,24 @@ int do_cmd_swtch(char *s) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+int lself = 0;
|
|
|
|
|
+
|
|
|
int do_cmd_uinfo(char *s) {
|
|
int do_cmd_uinfo(char *s) {
|
|
|
- char usrname[USRNAME_SIZE];
|
|
|
|
|
|
|
+ char name[USRNAME_SIZE];
|
|
|
|
|
|
|
|
- (void) s;
|
|
|
|
|
|
|
+ if (!lself) {
|
|
|
|
|
+ (void) s;
|
|
|
|
|
+
|
|
|
|
|
+ fprintf(stderr, "username: ");
|
|
|
|
|
+ scanf("%s", name);
|
|
|
|
|
+
|
|
|
|
|
+ get_user_info(name);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- fprintf(stderr, "username: ");
|
|
|
|
|
- scanf("%s", usrname);
|
|
|
|
|
|
|
+ else
|
|
|
|
|
+ /* s is the usrname of myself */
|
|
|
|
|
|
|
|
- get_user_info(usrname);
|
|
|
|
|
|
|
+ get_user_info(s);
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -295,12 +307,30 @@ int do_cmd_uinfo_bh(struct vcc_request *req) {
|
|
|
return 1;
|
|
return 1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- printf("%s's info: \n", u->usrname);
|
|
|
|
|
- printf("\tscore\tlevel\n");
|
|
|
|
|
- printf("\t%d\t%d\n", ntohl(u->score), ntohl(u->level));
|
|
|
|
|
|
|
+ if (lself) {
|
|
|
|
|
+ lself = 0;
|
|
|
|
|
+ self_level = ntohl(u->level);
|
|
|
|
|
+
|
|
|
|
|
+ printf("Level of yourself: %d\n", self_level);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ else {
|
|
|
|
|
+ printf("%s's info: \n", u->usrname);
|
|
|
|
|
+ printf("\tscore\tlevel\n");
|
|
|
|
|
+ printf("\t%d\t%d\n", ntohl(u->score), ntohl(u->level));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
pretty_prompt(usrname);
|
|
pretty_prompt(usrname);
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+int do_cmd_lself(char *s) {
|
|
|
|
|
+ (void) s;
|
|
|
|
|
+
|
|
|
|
|
+ lself = 1;
|
|
|
|
|
+ do_cmd_uinfo(usrname);
|
|
|
|
|
+
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|