diff options
author | Stig Bjørlykke <stig@bjorlykke.org> | 2009-12-03 14:01:18 +0000 |
---|---|---|
committer | Stig Bjørlykke <stig@bjorlykke.org> | 2009-12-03 14:01:18 +0000 |
commit | 39f0b9efde36d57693479071eb0413a6fce593f4 (patch) | |
tree | b5c52a358fde16532e4cae1937d0f3c7658d8837 /gtk | |
parent | a4538a17a8f2555463ac020f636e71544e133bbb (diff) | |
download | wireshark-39f0b9efde36d57693479071eb0413a6fce593f4.tar.gz |
Improved Apply/Prepare a filter from Packet List for custom columns:
- Add quotes for strings
- Use only protocol for protocol only columns
svn path=/trunk/; revision=31158
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/main.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/gtk/main.c b/gtk/main.c index 2c97663759..310a9be853 100644 --- a/gtk/main.c +++ b/gtk/main.c @@ -534,9 +534,22 @@ get_filter_from_packet_list_row_and_column(gpointer data) if (strlen(cfile.cinfo.col_expr.col_expr[column]) != 0 && strlen(cfile.cinfo.col_expr.col_expr_val[column]) != 0) { - /* leak a little but safer than ep_ here*/ - buf = se_strdup_printf("%s == %s", cfile.cinfo.col_expr.col_expr[column], - cfile.cinfo.col_expr.col_expr_val[column]); + /* leak a little but safer than ep_ here */ + if (cfile.cinfo.col_fmt[column] == COL_CUSTOM) { + header_field_info *hfi = proto_registrar_get_byname(cfile.cinfo.col_custom_field[column]); + if (hfi->parent == -1) { + /* Protocol only */ + buf = se_strdup(cfile.cinfo.col_expr.col_expr[column]); + } else if (hfi->type == FT_STRING) { + /* Custom string, add quotes */ + buf = se_strdup_printf("%s == \"%s\"", cfile.cinfo.col_expr.col_expr[column], + cfile.cinfo.col_expr.col_expr_val[column]); + } + } + if (buf == NULL) { + buf = se_strdup_printf("%s == %s", cfile.cinfo.col_expr.col_expr[column], + cfile.cinfo.col_expr.col_expr_val[column]); + } } epan_dissect_cleanup(&edt); |